C
- Class typepublic class ClassListParameter<C> extends ListParameter<ClassListParameter<C>,Class<? extends C>>
Modifier and Type | Field and Description |
---|---|
protected Class<C> |
restrictionClass
The restriction class for the list of class names.
|
LIST_SEP, SPLIT, VECTOR_SEP, VECTOR_SPLIT
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
Constructor and Description |
---|
ClassListParameter(OptionID optionID,
Class<?> restrictionClass)
Constructs a class list parameter with the given optionID and restriction
class.
|
ClassListParameter(OptionID optionID,
Class<?> restrictionClass,
boolean optional)
Constructs a class list parameter with the given optionID and restriction
class.
|
Modifier and Type | Method and Description |
---|---|
List<Class<?>> |
getKnownImplementations()
Get an iterator over all known implementations of the class restriction.
|
Class<C> |
getRestrictionClass()
Returns the restriction class of this class parameter.
|
String |
getSyntax()
Returns a string representation of the parameter's type.
|
String |
getValueAsString()
Get the value as string.
|
String |
getValuesDescription()
Return a description of known valid classes.
|
boolean |
hasValuesDescription()
This class sometimes provides a list of value descriptions.
|
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.
|
String |
restrictionString()
Provides a description string listing all classes for the given superclass
or interface as specified in the properties.
|
protected boolean |
validate(List<Class<? extends C>> obj)
Validate a value after parsing (e.g. do constrain checks!)
|
asString, getListSize
addConstraint, getDefaultValue, getDefaultValueAsString, getFullDescription, getGivenValue, getName, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue
public ClassListParameter(OptionID optionID, Class<?> restrictionClass, boolean optional)
optionID
- the unique id of this parameterrestrictionClass
- the restriction class of the list of class namesoptional
- specifies if this parameter is an optional parameterpublic String getValueAsString()
Parameter
null
getValueAsString
in interface Parameter<List<Class<? extends C>>>
getValueAsString
in class AbstractParameter<ClassListParameter<C>,List<Class<? extends C>>>
protected List<Class<? extends C>> parseValue(Object obj) throws ParameterException
AbstractParameter
parseValue
in class AbstractParameter<ClassListParameter<C>,List<Class<? extends C>>>
obj
- Object to parse (may be a string representation!)ParameterException
- when the object cannot be parsed.protected boolean validate(List<Class<? extends C>> obj) throws ParameterException
AbstractParameter
validate
in class AbstractParameter<ClassListParameter<C>,List<Class<? extends C>>>
obj
- Object to validateParameterException
- when the object is not valid.public Class<C> getRestrictionClass()
public List<Class<?>> getKnownImplementations()
public String getSyntax()
public List<C> instantiateClasses(Parameterization config)
config
- Parameterization to use (if Parameterizable))public String restrictionString()
public boolean hasValuesDescription()
hasValuesDescription
in interface Parameter<List<Class<? extends C>>>
hasValuesDescription
in class AbstractParameter<ClassListParameter<C>,List<Class<? extends C>>>
AbstractParameter.hasValuesDescription()
public String getValuesDescription()
getValuesDescription
in interface Parameter<List<Class<? extends C>>>
getValuesDescription
in class AbstractParameter<ClassListParameter<C>,List<Class<? extends C>>>
AbstractParameter.getValuesDescription()