T
- Type of the value.public class ParameterType<T> extends Type<ParameterType<T>> implements Serializable, Identifiable
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Field and Description |
---|---|
protected T |
defaultValue
Default value.
|
Constructor and Description |
---|
ParameterType(String id,
String description,
Class<T> valueClass)
Construct a new AbstractParameterType without default value and constraint.
|
ParameterType(String id,
String description,
Class<T> valueClass,
Constraint<? super T> constraint)
Construct a new AbstractParameterType without default value and with constraint.
|
ParameterType(String id,
String description,
Class<T> valueClass,
T defaultValue)
Construct a new AbstractParameterType with default value, without constraint.
|
ParameterType(String id,
String description,
Class<T> valueClass,
T defaultValue,
Constraint<? super T> constraint)
Construct a new AbstractParameterType with default value and constraint.
|
Modifier and Type | Method and Description |
---|---|
void |
check(T value,
Parameters params)
Default implementation of check method.
|
void |
checkConstraint(T value)
Check that a value complies with the constraint of this AbstractParameterType.
|
boolean |
equals(Object obj) |
Constraint<? super T> |
getConstraint()
Retrieve the constraint.
|
T |
getDefaultValue()
Retrieve the the default value of this AbstractParameterType.
|
String |
getDescription()
Retrieve the description of this AbstractParameterType.
|
String |
getId()
Retrieve the id of this AbstractParameterType.
|
Class<T> |
getValueClass()
Retrieve the class of the value of this AbstractParameterType.
|
boolean |
hasDefaultValue()
Returns whether this parameter type has a default value.
|
int |
hashCode() |
String |
printValue(Parameters parameters)
Print the given value from the map in Parameters in a presentable format.
|
String |
toString() |
protected final T defaultValue
public ParameterType(String id, String description, Class<T> valueClass)
id
- String; short name of the new AbstractParameterTypedescription
- String; description or full name of the new AbstractParameterTypevalueClass
- Class<T>; class of the value of the new AbstractParameterTypepublic ParameterType(String id, String description, Class<T> valueClass, Constraint<? super T> constraint)
id
- String; short name of the new AbstractParameterTypedescription
- String; description or full name of the new AbstractParameterTypevalueClass
- Class<T>; class of the value of the new AbstractParameterTypeconstraint
- Constraint<? super T>; constraint that applies to the value of the new AbstractParameterTypepublic ParameterType(String id, String description, Class<T> valueClass, T defaultValue)
id
- String; short name of the new AbstractParameterTypedescription
- String; description or full name of the new AbstractParameterTypevalueClass
- Class<T>; class of the value of the new AbstractParameterTypedefaultValue
- T; default value of the new AbstractParameterTypepublic ParameterType(String id, String description, Class<T> valueClass, T defaultValue, Constraint<? super T> constraint)
id
- String; short name of the new AbstractParameterTypedescription
- String; description or full name of the new AbstractParameterTypevalueClass
- Class<T>; class of the value of the new AbstractParameterTypedefaultValue
- T; default value of the new AbstractParameterTypeconstraint
- Constraint<? super T>; constraint that applies to the value of the new AbstractParameterTypepublic final String getId()
getId
in interface Identifiable
public final String getDescription()
public final Class<T> getValueClass()
public final boolean hasDefaultValue()
public final T getDefaultValue() throws ParameterException
ParameterException
- if this AbstractParameterType does not have a default valuepublic final void checkConstraint(T value) throws ParameterException
value
- T; the value to checkParameterException
- if the value does not comply with constraintspublic void check(T value, Parameters params) throws ParameterException
value
- T; the value to checkparams
- Parameters; Set of parameters to checkParameterException
- If the value does not comply with constraints.public String printValue(Parameters parameters) throws ParameterException
parameters
- Parameters; Parameters to get the value fromParameterException
- If the parameter is not presentpublic final Constraint<? super T> getConstraint()
Copyright © 2014–2019 Delft University of Technology. All rights reserved.