org.jboss.virtual.spi
Interface Options

All Known Implementing Classes:
DefaultOptions

public interface Options

Options interface.

Author:
Ales Justin

Method Summary
 void addOption(String name, Object option)
          Set an option against the type.
 void addOptions(Map<String,?> map)
          Add options.
 boolean getBooleanOption(String name)
          Get boolean option.
<T> T
getOption(Class<T> expectedType)
          Get option.
 Object getOption(String name)
          Get an option from the type
<T> T
getOption(String name, Class<T> expectedType)
          Get the option.
<T> Map<String,T>
getOptions(Class<T> exactType)
          Get all options that match type.
 void merge(Options other)
          Merge options.
 void removeOption(String name)
          Remove an option
 int size()
          Get options size.
 

Method Detail

size

int size()
Get options size.

Returns:
the size

merge

void merge(Options other)
Merge options.

Parameters:
other - the other options

getOptions

<T> Map<String,T> getOptions(Class<T> exactType)
Get all options that match type.

Type Parameters:
T - the exact type
Parameters:
exactType - the exact type
Returns:
matching options

addOption

void addOption(String name,
               Object option)
Set an option against the type. This is useful for caching information against a type.

If you add a future object, subsequent gets will wait for the result

WARNING: Be careful about what you put in here. Don't create references across classloaders, if you are not sure add a WeakReference to the information.

Parameters:
name - the name
option - the option, pass null to remove an option
Throws:
IllegalArgumentException - for a null name

addOptions

void addOptions(Map<String,?> map)
Add options.

Parameters:
map - the options map
Throws:
IllegalArgumentException - for a null map

removeOption

void removeOption(String name)
Remove an option

Parameters:
name - the name
Throws:
IllegalArgumentException - for a null name

getOption

Object getOption(String name)
Get an option from the type

Parameters:
name - the name
Returns:
the option

getOption

<T> T getOption(Class<T> expectedType)
Get option.

Type Parameters:
T - the expectedType
Parameters:
expectedType - the expected type.
Returns:
the option

getOption

<T> T getOption(String name,
                Class<T> expectedType)
Get the option.

Type Parameters:
T - the expected type
Parameters:
name - the name
expectedType - the expected type
Returns:
the option or null if no such matching exists

getBooleanOption

boolean getBooleanOption(String name)
Get boolean option.

Parameters:
name - the name
Returns:
boolean option value


Copyright © 2011 JBoss, A division of Red Hat, Inc. All Rights Reserved.