de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters
Class ObjectListParameter<C>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter<List<T>,List<T>>
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ListParameter<Class<? extends C>>
          extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassListParameter<C>
              extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ObjectListParameter<C>
Type Parameters:
C - Class type

public class ObjectListParameter<C>
extends ClassListParameter<C>

Parameter that represents a list of objects (in contrast to a class list parameter, they will be instanced at most once.)


Field Summary
private  ArrayList<C> instances
          Cache for the generated instances.
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassListParameter
restrictionClass
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ListParameter
LIST_SEP, SPLIT, VECTOR_SEP, VECTOR_SPLIT
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
 
Constructor Summary
ObjectListParameter(OptionID optionID, Class<?> restrictionClass)
          Constructor for non-optional.
ObjectListParameter(OptionID optionID, Class<?> restrictionClass, boolean optional)
          Constructor with optional flag.
 
Method Summary
 String getSyntax()
          Returns a string representation of the parameter's type.
 List<C> instantiateClasses(Parameterization config)
          Returns a list of new instances for the value (i.e., the class name) of this class list parameter.
protected  List<Class<? extends C>> parseValue(Object obj)
          Parse a given value into the destination type.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassListParameter
getKnownImplementations, getRestrictionClass, getRestrictionClasses, getValueAsString, getValuesDescription, hasValuesDescription, restrictionString, validate
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ListParameter
asString, getListSize
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter
addConstraint, getDefaultValue, getDefaultValueAsString, getFullDescription, getGivenValue, getName, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instances

private ArrayList<C> instances
Cache for the generated instances.

Constructor Detail

ObjectListParameter

public ObjectListParameter(OptionID optionID,
                           Class<?> restrictionClass,
                           boolean optional)
Constructor with optional flag.

Parameters:
optionID - Option ID
restrictionClass - Restriction class
optional - optional flag

ObjectListParameter

public ObjectListParameter(OptionID optionID,
                           Class<?> restrictionClass)
Constructor for non-optional.

Parameters:
optionID - Option ID
restrictionClass - Restriction class
Method Detail

getSyntax

public String getSyntax()
Returns a string representation of the parameter's type.

Overrides:
getSyntax in class ClassListParameter<C>
Returns:
"<class_1,...,class_n>"

parseValue

protected List<Class<? extends C>> parseValue(Object obj)
                                       throws ParameterException
Parse a given value into the destination type.

Overrides:
parseValue in class ClassListParameter<C>
Parameters:
obj - Object to parse (may be a string representation!)
Returns:
Parsed object
Throws:
ParameterException - when the object cannot be parsed.

instantiateClasses

public List<C> instantiateClasses(Parameterization config)
Returns a list of new instances for the value (i.e., the class name) of this class list parameter. The instances have the type of the restriction class of this class list parameter.

If the Class for the class names is not found, the instantiation is tried using the package of the restriction class as package of the class name.

Overrides:
instantiateClasses in class ClassListParameter<C>
Parameters:
config - Parameterization to use (if Parameterizable))
Returns:
a list of new instances for the value of this class list parameter

Release 0.4.0 (2011-09-20_1324)