C
- Class typepublic class ObjectParameter<C> extends ClassParameter<C>
Modifier and Type | Field and Description |
---|---|
private C |
instance
The instance to use.
|
restrictionClass
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
Constructor and Description |
---|
ObjectParameter(OptionID optionID,
java.lang.Class<?> restrictionClass)
Constructs a class parameter with the given optionID, and restriction
class.
|
ObjectParameter(OptionID optionID,
java.lang.Class<?> restrictionClass,
boolean optional)
Constructs a class parameter with the given optionID, restriction class,
and optional flag.
|
ObjectParameter(OptionID optionID,
java.lang.Class<?> restrictionClass,
java.lang.Class<?> defaultValue)
Constructs a class parameter with the given optionID, restriction class,
and default value.
|
ObjectParameter(OptionID optionID,
java.lang.Class<?> restrictionClass,
T defaultValue)
Constructs a class parameter with the given optionID, restriction class,
and default value.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getSyntax()
Returns a string representation of the parameter's type.
|
C |
instantiateClass(Parameterization config)
Returns a new instance for the value (i.e., the class name) of this class
parameter.
|
protected java.lang.Class<? extends C> |
parseValue(java.lang.Object obj)
Parse a given value into the destination type.
|
void |
setValue(java.lang.Object obj)
Sets the value of the option.
|
canonicalClassName, canonicalClassName, describeValues, getDefaultValueAsString, getKnownImplementations, getRestrictionClass, getValueAsString, validate
addConstraint, getConstraints, getDefaultValue, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValueInternal, tookDefaultValue, tryDefaultValue
private C instance
public ObjectParameter(OptionID optionID, java.lang.Class<?> restrictionClass, java.lang.Class<?> defaultValue)
optionID
- the unique id of the optionrestrictionClass
- the restriction class of this class parameterdefaultValue
- the default value of this class parameterpublic ObjectParameter(OptionID optionID, java.lang.Class<?> restrictionClass, T defaultValue)
T
- default value type, to solve generics problems.optionID
- the unique id of the optionrestrictionClass
- the restriction class of this class parameterdefaultValue
- the default instance of this class parameterpublic ObjectParameter(OptionID optionID, java.lang.Class<?> restrictionClass, boolean optional)
optionID
- the unique id of the optionrestrictionClass
- the restriction class of this class parameteroptional
- specifies if this parameter is an optional parameterpublic ObjectParameter(OptionID optionID, java.lang.Class<?> restrictionClass)
optionID
- the unique id of the optionrestrictionClass
- the restriction class of this class parameterprotected java.lang.Class<? extends C> parseValue(java.lang.Object obj) throws ParameterException
AbstractParameter
parseValue
in class ClassParameter<C>
obj
- Object to parse (may be a string representation!)ParameterException
- when the object cannot be parsed.public void setValue(java.lang.Object obj) throws ParameterException
Parameter
setValue
in interface Parameter<java.lang.Class<? extends C>>
setValue
in class AbstractParameter<ClassParameter<C>,java.lang.Class<? extends C>>
obj
- the option's value to be setParameterException
- if the given value is not a valid value for this
option.public java.lang.String getSyntax()
public C instantiateClass(Parameterization config)
If the Class for the class name is not found, the instantiation is tried using the package of the restriction class as package of the class name.F
instantiateClass
in class ClassParameter<C>
config
- ParameterizationCopyright © 2019 ELKI Development Team. License information.