|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter<Class<?>,Class<? extends C>> de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassParameter<C> de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ObjectParameter<C>
C
- Class typepublic class ObjectParameter<C>
Parameter class for a parameter representing a single object. It can be parameterized by giving a class name or class to instantiate, or an existing instance.
Field Summary | |
---|---|
private C |
instance
The instance to use. |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassParameter |
---|
FACTORY_POSTFIX, restrictionClass |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter |
---|
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription |
Constructor Summary | |
---|---|
ObjectParameter(OptionID optionID,
Class<?> restrictionClass)
Constructs a class parameter with the given optionID, and restriction class. |
|
ObjectParameter(OptionID optionID,
Class<?> restrictionClass,
boolean optional)
Constructs a class parameter with the given optionID, restriction class, and optional flag. |
|
ObjectParameter(OptionID optionID,
Class<?> restrictionClass,
Class<?> defaultValue)
Constructs a class parameter with the given optionID, restriction class, and default value. |
|
ObjectParameter(OptionID optionID,
Class<?> restrictionClass,
T defaultValue)
Constructs a class parameter with the given optionID, restriction class, and default value. |
Method Summary | |
---|---|
Object |
getGivenValue()
Get the last given value. |
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 Class<? extends C> |
parseValue(Object obj)
Parse a given value into the destination type. |
void |
setValue(Object obj)
Sets the value of the option. |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ClassParameter |
---|
canonicalClassName, canonicalClassName, getDefaultValueAsString, getKnownImplementations, getRestrictionClass, getRestrictionClasses, getValueAsString, getValuesDescription, hasValuesDescription, restrictionString, validate |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter |
---|
addConstraint, getDefaultValue, getFullDescription, getName, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private C instance
Constructor Detail |
---|
public ObjectParameter(OptionID optionID, Class<?> restrictionClass, 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, 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, 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, Class<?> restrictionClass)
optionID
- the unique id of the optionrestrictionClass
- the restriction class of this class parameterMethod Detail |
---|
protected Class<? extends C> parseValue(Object obj) throws ParameterException
parseValue
in class ClassParameter<C>
obj
- Object to parse (may be a string representation!)
ParameterException
- when the object cannot be parsed.public void setValue(Object obj) throws ParameterException
setValue
in class Parameter<Class<?>,Class<? extends C>>
obj
- the option's value to be set
ParameterException
- if the given value is not a valid value for this
option.public String getSyntax()
getSyntax
in class ClassParameter<C>
public C instantiateClass(Parameterization config)
instantiateClass
in class ClassParameter<C>
config
- Parameterization
public Object getGivenValue()
null
getGivenValue
in class Parameter<Class<?>,Class<? extends C>>
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |