|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.logging.AbstractLoggable
de.lmu.ifi.dbs.elki.utilities.optionhandling.Option<T>
de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter<String,String>
de.lmu.ifi.dbs.elki.utilities.optionhandling.ClassParameter<C>
public class ClassParameter<C>
Parameter class for a parameter specifying a class name.
Field Summary | |
---|---|
private Class<C> |
restrictionClass
The restriction class for this class parameter. |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter |
---|
constraints, defaultValue, optionalParameter |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option |
---|
name, shortDescription, value |
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debug |
Constructor Summary | |
---|---|
ClassParameter(OptionID optionID,
Class<C> restrictionClass)
Constructs a class parameter with the given optionID, and restriction class. |
|
ClassParameter(OptionID optionID,
Class<C> restrictionClass,
boolean optional)
Constructs a class parameter with the given optionID, restriction class, and optional flag. |
|
ClassParameter(OptionID optionID,
Class<C> restrictionClass,
String defaultValue)
Constructs a class parameter with the given optionID, restriction class, and default value. |
|
ClassParameter(String name,
String description,
Class<C> restrictionClass)
Deprecated. |
|
ClassParameter(String name,
String description,
Class<C> restrictionClass,
String defaultValue)
Deprecated. |
Method Summary | |
---|---|
protected String |
getParameterType()
Returns a string representation of the parameter's type. |
Class<C> |
getRestrictionClass()
Returns the restriction class of this class parameter. |
String[] |
getRestrictionClasses()
Returns the class names allowed according to the restriction class of this class parameter. |
C |
instantiateClass()
Returns a new instance for the value (i.e., the class name) of this class parameter. |
boolean |
isValid(String value)
Checks if the given parameter value is valid for this ClassParameter. |
private void |
setCorrectValue(String value)
Tries to set the correct value for this class parameter. |
void |
setRestrictionClass(Class<C> restrictionClass)
Sets the restriction class of this class parameter. |
void |
setValue(String value)
Sets the value of the option. |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter |
---|
addConstraint, addConstraintList, getDefaultValue, getDescription, getValue, hasDefaultValue, isOptional, isSet, reset, setDefaultValue, setDefaultValueToValue, setOptional, tookDefaultValue |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option |
---|
getName, getShortDescription, setShortDescription |
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Class<C> restrictionClass
Constructor Detail |
---|
public ClassParameter(OptionID optionID, Class<C> restrictionClass)
optionID
- the unique id of the optionrestrictionClass
- the restriction class of this class parameterpublic ClassParameter(OptionID optionID, Class<C> 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 ClassParameter(OptionID optionID, Class<C> restrictionClass, String defaultValue)
optionID
- the unique id of the optionrestrictionClass
- the restriction class of this class parameterdefaultValue
- the default value of this class parameter@Deprecated public ClassParameter(String name, String description, Class<C> restrictionClass)
name
- the parameter namedescription
- the parameter descriptionrestrictionClass
- the restriction class of this class parameter@Deprecated public ClassParameter(String name, String description, Class<C> restrictionClass, String defaultValue)
name
- the parameter namedescription
- the parameter descriptionrestrictionClass
- the restriction class of this class parameterdefaultValue
- the default value of this class parameterMethod Detail |
---|
public void setValue(String value) throws ParameterException
Option
setValue
in class Option<String>
value
- the option's value to be set
ParameterException
- if the given value is not a valid value for this option.Option.setValue(String)
public String[] getRestrictionClasses()
public boolean isValid(String value) throws ParameterException
isValid
in class Option<String>
value
- option value to be checked
ParameterException
- if the given value is not a valid value for this option.Option.isValid(String)
public Class<C> getRestrictionClass()
public void setRestrictionClass(Class<C> restrictionClass)
restrictionClass
- the restriction class to be setprivate void setCorrectValue(String value) throws ParameterException
value
- the value to be set
ParameterException
- if the specified value is not correct (e.g., it is
not conform with the restriction class)protected String getParameterType()
getParameterType
in class Parameter<String,String>
Parameter.getParameterType()
public C instantiateClass() throws ParameterException
ParameterException
- if the instantiation cannot be performed successfully
or the value of this class parameter is not set
|
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |