|
|
|||||||||||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||||||||||
java.lang.Objectde.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>
C - Class typepublic class ClassParameter<C>
Parameter class for a parameter specifying a class name.
| Field Summary | |
|---|---|
protected static Logging |
logger
Logger |
static String |
NONBREAKING_SPACE
Non-breaking unicode space character. |
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 |
|---|
optionid, shortDescription, value |
| Constructor Summary | |
|---|---|
ClassParameter(OptionID optionID,
Class<?> restrictionClass)
Constructs a class parameter with the given optionID, and restriction class. |
|
ClassParameter(OptionID optionID,
Class<?> restrictionClass,
boolean optional)
Constructs a class parameter with the given optionID, restriction class, and optional flag. |
|
ClassParameter(OptionID optionID,
Class<?> restrictionClass,
String defaultValue)
Constructs a class parameter with the given optionID, restriction class, and default value. |
|
| Method Summary | |
|---|---|
IterateKnownImplementations |
getKnownImplementations()
Get an iterator over all known implementations of the class restriction. |
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. |
String |
getSyntax()
Returns a string representation of the parameter's type. |
String |
getValuesDescription()
Return a description of known valid classes. |
boolean |
hasValuesDescription()
This class sometimes provides a list of value descriptions. |
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. |
String |
restrictionString(Class<?> superclass)
Provides a description string listing all classes for the given superclass or interface as specified in the properties. |
static boolean |
satisfiesClassRestriction(Class<?> restrictionClass,
String value)
Try to satisfy a single class restriction |
private void |
setCorrectValue(String value)
Tries to set the correct value for 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, getFullDescription, getValue, hasDefaultValue, isOptional, isSet, reset, setDefaultValue, setDefaultValueToValue, setOptional, tookDefaultValue |
| Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option |
|---|
getName, getOptionID, getShortDescription, setShortDescription |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Logging logger
private Class<C> restrictionClass
public static final String NONBREAKING_SPACE
| Constructor Detail |
|---|
public ClassParameter(OptionID optionID,
Class<?> restrictionClass)
optionID - the unique id of the optionrestrictionClass - the restriction class of this class parameter
public ClassParameter(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 parameter
public ClassParameter(OptionID optionID,
Class<?> restrictionClass,
String defaultValue)
optionID - the unique id of the optionrestrictionClass - the restriction class of this class parameterdefaultValue - the default value of this class parameter| Method 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.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.
public static boolean satisfiesClassRestriction(Class<?> restrictionClass,
String value)
throws ClassNotFoundException
restrictionClass - value -
ClassNotFoundExceptionpublic Class<C> getRestrictionClass()
private 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)public String getSyntax()
getSyntax in class Option<String>
public C instantiateClass()
throws ParameterException
ParameterException - if the instantiation cannot be performed
successfully or the value of this class parameter is not setpublic boolean hasValuesDescription()
hasValuesDescription in class Parameter<String,String>Parameter.hasValuesDescription()public String getValuesDescription()
getValuesDescription in class Parameter<String,String>Parameter.getValuesDescription()public IterateKnownImplementations getKnownImplementations()
Iterable and Iterator objectpublic String restrictionString(Class<?> superclass)
superclass - the class to be extended or interface to be implemented
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||