Home » openejb-3.1.2-src » org.apache » openejb » loader » [javadoc | source]
org.apache.openejb.loader
public class: Options [javadoc | source]
java.lang.Object
   org.apache.openejb.loader.Options

Direct Known Subclasses:
    NullOptions

The purpose of this class is to provide a more strongly typed version of a java.util.Properties object. So far it is a read only view of the properties and does not set data into the underlying Properties instance.

Similar to java.util.Properties it will delegate to a "parent" instance when a property is not found. If a property is found but its value cannot be parsed as the desired data type, the parent's value is used.

By default this object will log nothing, but if a Log implementation is set the Options class will log three kinds of statements:

- When a property is not found: the property name and default value in use along with all possible values (enums only). Debug level. - When a property is found: the property name and value. Info level. - When a property value cannot be parsed: the property name and invalid value. Warn level. Logging the user supplied values onto INFO is really nice as it shows up in the standard log output and allows us to easily see which values the user has changed from the default. It's rather impossible to diagnose issues without this information. ENUM SETS: Properties that accept a Set of enum values automatically accept ALL and NONE in addition to the explicitly created enum items. Using ALL. This allows users to have an easy way to imply "all" without having to hardcode an the entire list of enum items and protects against the case where that list may grow in the future. Using NONE. This allows users an alternative to using an empty string when explicitly specifying that none of the options should be used. In the internal code, this allows us to have these concepts in all enum options without us having to add NONE or ALL enum items explicitly which leads to strange code. Additionally TRUE is an alias for ALL and FALSE an alias for NONE. This allows options that used to support only true/false values to be further defined in the future without breaking compatibility.

Nested Class Summary:
public static interface  Options.Log   
public static class  Options.NullLog   
Constructor:
 public Options(Properties properties) 
 public Options(Properties properties,
    Options parent) 
Method from org.apache.openejb.loader.Options Summary:
get,   get,   get,   get,   get,   get,   getAll,   getAll,   getAll,   getAll,   getLogger,   has,   join,   logAll,   lowercase,   lowercase,   possibleValues,   possibleValues,   setLogger,   valueOf
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.openejb.loader.Options Detail:
 public String get(String property,
    String defaultValue) 
 public int get(String property,
    int defaultValue) 
 public long get(String property,
    long defaultValue) 
 public boolean get(String property,
    boolean defaultValue) 
 public Class get(String property,
    Class defaultValue) 
 public T get(String property,
    T defaultValue) 
 public Set<T> getAll(String property,
    T defaultValue) 
 public Set<T> getAll(String property,
    Set<T> defaultValue) 
 public Set<T> getAll(String property,
    Class<T> enumType) 
 protected Set<T> getAll(String property,
    Set<T> defaultValue,
    Class<T> enumType) 
 public Log getLogger() 
 public boolean has(String property) 
 public static String join(String delimiter,
    Object collection) 
 public Set<T> logAll(String property,
    Set<T> value) 
 protected static String[] lowercase(T items) 
 protected static String[] lowercase(Collection<T> items) 
 protected static String possibleValues(V v) 
 protected static String possibleValues(Class<Enum> enumType) 
 public  void setLogger(Log logger) 
 public static T valueOf(Class<T> enumType,
    String name) 
    Use this instead of Enum.valueOf() when you want to ensure that the the enum values are case insensitive.