C
- Class typepublic class ClassListParameter<C> extends ListParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
Modifier and Type | Field and Description |
---|---|
protected java.lang.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,
java.lang.Class<?> restrictionClass)
Constructs a class list parameter with the given optionID and restriction
class.
|
ClassListParameter(OptionID optionID,
java.lang.Class<?> restrictionClass,
boolean optional)
Constructs a class list parameter with the given optionID and restriction
class.
|
Modifier and Type | Method and Description |
---|---|
java.lang.StringBuilder |
describeValues(java.lang.StringBuilder buf)
Describe the valid values.
|
protected java.lang.String |
formatValue(java.util.List<java.lang.Class<? extends C>> val)
Format as string.
|
java.lang.String |
getDefaultValueAsString()
Get the default value as string.
|
java.util.List<java.lang.Class<?>> |
getKnownImplementations()
Get an iterator over all known implementations of the class restriction.
|
java.lang.Class<C> |
getRestrictionClass()
Returns the restriction class of this class parameter.
|
java.lang.String |
getSyntax()
Returns a string representation of the parameter's type.
|
java.lang.String |
getValueAsString()
Get the value as string.
|
java.util.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 java.util.List<java.lang.Class<? extends C>> |
parseValue(java.lang.Object obj)
Parse a given value into the destination type.
|
int |
size()
Size of the list.
|
protected boolean |
validate(java.util.List<java.lang.Class<? extends C>> obj)
Validate a value after parsing (e.g. do constraint checks!)
|
addConstraint, getConstraints, getDefaultValue, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue
protected java.lang.Class<C> restrictionClass
public ClassListParameter(OptionID optionID, java.lang.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 ClassListParameter(OptionID optionID, java.lang.Class<?> restrictionClass)
optionID
- the unique id of this parameterrestrictionClass
- the restriction class of the list of class namespublic java.lang.String getValueAsString()
Parameter
null
getValueAsString
in interface Parameter<java.util.List<java.lang.Class<? extends C>>>
getValueAsString
in class AbstractParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
public java.lang.String getDefaultValueAsString()
Parameter
getDefaultValueAsString
in interface Parameter<java.util.List<java.lang.Class<? extends C>>>
getDefaultValueAsString
in class AbstractParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
protected java.lang.String formatValue(java.util.List<java.lang.Class<? extends C>> val)
val
- Value to formatprotected java.util.List<java.lang.Class<? extends C>> parseValue(java.lang.Object obj) throws ParameterException
AbstractParameter
parseValue
in class AbstractParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
obj
- Object to parse (may be a string representation!)ParameterException
- when the object cannot be parsed.protected boolean validate(java.util.List<java.lang.Class<? extends C>> obj) throws ParameterException
AbstractParameter
validate
in class AbstractParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
obj
- Object to validateParameterException
- when the object is not valid.public java.lang.Class<C> getRestrictionClass()
public java.util.List<java.lang.Class<?>> getKnownImplementations()
public java.lang.String getSyntax()
getSyntax
in interface Parameter<java.util.List<java.lang.Class<? extends C>>>
getSyntax
in class AbstractParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
public java.util.List<C> instantiateClasses(Parameterization config)
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.
config
- Parameterization to use (if Parameterizable))public java.lang.StringBuilder describeValues(java.lang.StringBuilder buf)
Parameter
describeValues
in interface Parameter<java.util.List<java.lang.Class<? extends C>>>
describeValues
in class AbstractParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
buf
- Buffer to append topublic int size()
ListParameter
size
in class ListParameter<ClassListParameter<C>,java.util.List<java.lang.Class<? extends C>>>
Copyright © 2019 ELKI Development Team. License information.