C
- Class typepublic class ClassParameter<C> extends AbstractParameter<ClassParameter<C>,Class<? extends C>>
Modifier and Type | Field and Description |
---|---|
private static Logging |
LOG
The class logger.
|
protected Class<C> |
restrictionClass
The restriction class for this class parameter.
|
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
Constructor and Description |
---|
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,
Class<?> defaultValue)
Constructs a class parameter with the given optionID, restriction class,
and default value.
|
Modifier and Type | Method and Description |
---|---|
static String |
canonicalClassName(Class<?> c,
Class<?> parent)
Get the "simple" form of a class name.
|
static String |
canonicalClassName(Class<?> c,
Package pkg,
String postfix)
Get the "simple" form of a class name.
|
String |
getDefaultValueAsString()
Get the default value as string.
|
List<Class<?>> |
getKnownImplementations()
Get an iterator over all known implementations of the class restriction.
|
Class<C> |
getRestrictionClass()
Returns the restriction class of this class parameter.
|
String |
getSyntax()
Returns a string representation of the parameter's type.
|
String |
getValueAsString()
Get the value as string.
|
String |
getValuesDescription()
Return a description of known valid classes.
|
boolean |
hasValuesDescription()
This class sometimes provides a list of value descriptions.
|
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.
|
boolean |
validate(Class<? extends C> obj)
Checks if the given parameter value is valid for this ClassParameter.
|
addConstraint, getDefaultValue, getFullDescription, getGivenValue, getName, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue
private static final Logging LOG
public ClassParameter(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 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 parameterprotected Class<? extends C> parseValue(Object obj) throws ParameterException
AbstractParameter
parseValue
in class AbstractParameter<ClassParameter<C>,Class<? extends C>>
obj
- Object to parse (may be a string representation!)ParameterException
- when the object cannot be parsed.public boolean validate(Class<? extends C> obj) throws ParameterException
validate
in class AbstractParameter<ClassParameter<C>,Class<? extends C>>
obj
- Object to validateParameterException
- when the object is not valid.public String getSyntax()
getSyntax
in interface Parameter<Class<? extends C>>
getSyntax
in class AbstractParameter<ClassParameter<C>,Class<? extends C>>
public boolean hasValuesDescription()
hasValuesDescription
in interface Parameter<Class<? extends C>>
hasValuesDescription
in class AbstractParameter<ClassParameter<C>,Class<? extends C>>
AbstractParameter.hasValuesDescription()
public String getValuesDescription()
getValuesDescription
in interface Parameter<Class<? extends C>>
getValuesDescription
in class AbstractParameter<ClassParameter<C>,Class<? extends C>>
AbstractParameter.getValuesDescription()
public String getValueAsString()
Parameter
null
getValueAsString
in interface Parameter<Class<? extends C>>
getValueAsString
in class AbstractParameter<ClassParameter<C>,Class<? extends C>>
public C instantiateClass(Parameterization config)
config
- Parameterization to use (if Parameterizable))public Class<C> getRestrictionClass()
public List<Class<?>> getKnownImplementations()
public static String canonicalClassName(Class<?> c, Package pkg, String postfix)
c
- Classpkg
- Packagepostfix
- Postfix to strippublic static String canonicalClassName(Class<?> c, Class<?> parent)
c
- Class nameparent
- Parent/restriction class (to get package name to strip)public String getDefaultValueAsString()
Parameter
getDefaultValueAsString
in interface Parameter<Class<? extends C>>
getDefaultValueAsString
in class AbstractParameter<ClassParameter<C>,Class<? extends C>>
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.