de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters
Class ObjectListParameter<C>
java.lang.Object
de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter<List<T>,List<T>>
de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ListParameter<Class<? extends C>>
de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassListParameter<C>
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.)
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 |
instances
private ArrayList<C> instances
- Cache for the generated instances.
ObjectListParameter
public ObjectListParameter(OptionID optionID,
Class<?> restrictionClass,
boolean optional)
- Constructor with optional flag.
- Parameters:
optionID
- Option IDrestrictionClass
- Restriction classoptional
- optional flag
ObjectListParameter
public ObjectListParameter(OptionID optionID,
Class<?> restrictionClass)
- Constructor for non-optional.
- Parameters:
optionID
- Option IDrestrictionClass
- Restriction class
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