Class ParameterTypeClass<T>
java.lang.Object
org.opentrafficsim.base.Type<ParameterType<T>>
org.opentrafficsim.base.parameters.ParameterType<Class<? extends T>>
org.opentrafficsim.base.parameters.ParameterTypeClass<T>
- Type Parameters:
T- class, e.g. TacticalPlanner
- All Implemented Interfaces:
Serializable,Identifiable
public class ParameterTypeClass<T> extends ParameterType<Class<? extends T>>
Parameter type for classes, of which the value may need to be present in a constraint set.
Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 30 jun. 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ParameterTypeClass(String id, String description, Class<Class<? extends T>> valueClass)Constructor without default value and check.ParameterTypeClass(String id, String description, Class<Class<? extends T>> valueClass, Class<? extends T> defaultValue)Constructor with default value, without check.ParameterTypeClass(String id, String description, Class<Class<? extends T>> valueClass, Class<? extends T> defaultValue, Constraint<? super Class<? extends T>> constraint)Constructor with default value and check.ParameterTypeClass(String id, String description, Class<Class<? extends T>> valueClass, Constraint<? super Class<? extends T>> constraint)Constructor without default value, with check. -
Method Summary
Modifier and Type Method Description static <T> Class<Class<? extends T>>getValueClass(Class<T> clazz)Returns a typed class, where the type isClass<? extends T>, such thatParameterTypeClassinstances can easily be created.StringprintValue(Parameters parameters)Print the given value from the map in Parameters in a presentable format.StringtoString()Methods inherited from class org.opentrafficsim.base.parameters.ParameterType
check, checkConstraint, equals, getConstraint, getDefaultValue, getDescription, getId, getValueClass, hasDefaultValue, hashCode
-
Constructor Details
-
ParameterTypeClass
Constructor without default value and check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<Class<? extends T>>; Class of the value.
-
ParameterTypeClass
public ParameterTypeClass(String id, String description, Class<Class<? extends T>> valueClass, Class<? extends T> defaultValue)Constructor with default value, without check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<Class<? extends T>>; Class of the value.defaultValue- Class<? extends T>; Default value.
-
ParameterTypeClass
public ParameterTypeClass(String id, String description, Class<Class<? extends T>> valueClass, Constraint<? super Class<? extends T>> constraint)Constructor without default value, with check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<Class<? extends T>>; Class of the value.constraint- Constraint<? super Class<? extends T>>; Constraint for parameter values.
-
ParameterTypeClass
public ParameterTypeClass(String id, String description, Class<Class<? extends T>> valueClass, Class<? extends T> defaultValue, Constraint<? super Class<? extends T>> constraint)Constructor with default value and check.- Parameters:
id- String; Short name of parameter.description- String; Parameter description or full name.valueClass- Class<Class<? extends T>>; Class of the value.defaultValue- Class<? extends T>; Default value.constraint- Constraint<? super Class<? extends T>>; Constraint for parameter values.
-
-
Method Details
-
getValueClass
Returns a typed class, where the type isClass<? extends T>, such thatParameterTypeClassinstances can easily be created.- Type Parameters:
T- constraining class in parameter type, e.g. TacticalPlanner- Parameters:
clazz- Class<T>; class instance- Returns:
- typed class
-
printValue
Print the given value from the map in Parameters in a presentable format. The default implementation simply returns the output of toString().- Overrides:
printValuein classParameterType<Class<? extends T>>- Parameters:
parameters- Parameters; Parameters to get the value from- Returns:
- String; readable representation of the value
- Throws:
ParameterException- If the parameter is not present
-
toString
- Overrides:
toStringin classParameterType<Class<? extends T>>
-