org.jboss.virtual.plugins.context
Class DefaultOptions

java.lang.Object
  extended by org.jboss.virtual.plugins.context.DefaultOptions
All Implemented Interfaces:
Options

public class DefaultOptions
extends Object
implements Options

Options impl.

Author:
Ales Justin

Constructor Summary
DefaultOptions()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultOptions

public DefaultOptions()
Method Detail

size

public int size()
Description copied from interface: Options
Get options size.

Specified by:
size in interface Options
Returns:
the size

merge

public void merge(Options other)
Description copied from interface: Options
Merge options.

Specified by:
merge in interface Options
Parameters:
other - the other options

getOptions

public <T> Map<String,T> getOptions(Class<T> exactType)
Description copied from interface: Options
Get all options that match type.

Specified by:
getOptions in interface Options
Type Parameters:
T - the exact type
Parameters:
exactType - the exact type
Returns:
matching options

addOption

public void addOption(String name,
                      Object option)
Description copied from interface: Options
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.

Specified by:
addOption in interface Options
Parameters:
name - the name
option - the option, pass null to remove an option

addOptions

public void addOptions(Map<String,?> map)
Description copied from interface: Options
Add options.

Specified by:
addOptions in interface Options
Parameters:
map - the options map

removeOption

public void removeOption(String name)
Description copied from interface: Options
Remove an option

Specified by:
removeOption in interface Options
Parameters:
name - the name

getOption

public Object getOption(String name)
Description copied from interface: Options
Get an option from the type

Specified by:
getOption in interface Options
Parameters:
name - the name
Returns:
the option

getOption

public <T> T getOption(Class<T> expectedType)
Description copied from interface: Options
Get option.

Specified by:
getOption in interface Options
Type Parameters:
T - the expectedType
Parameters:
expectedType - the expected type.
Returns:
the option

getOption

public <T> T getOption(String name,
                       Class<T> expectedType)
Description copied from interface: Options
Get the option.

Specified by:
getOption in interface Options
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

public boolean getBooleanOption(String name)
Description copied from interface: Options
Get boolean option.

Specified by:
getBooleanOption in interface Options
Parameters:
name - the name
Returns:
boolean option value


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