C
- Class typepublic class ObjectParameter<C> extends ClassParameter<C>
Modifier and Type | Field and Description |
---|---|
private C |
instance
The instance to use.
|
FACTORY_POSTFIX, restrictionClass
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
canonicalClassName, canonicalClassName, getDefaultValueAsString, getKnownImplementations, getRestrictionClass, getRestrictionClasses, getValueAsString, getValuesDescription, hasValuesDescription, restrictionString, validate
addConstraint, getDefaultValue, getFullDescription, getName, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue
private C instance
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 parameterprotected 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
public String getSyntax()
getSyntax
in class ClassParameter<C>
public C instantiateClass(Parameterization config)
instantiateClass
in class ClassParameter<C>
config
- Parameterization