public class ParameterSetParser extends Object
Parameter
s and creates instances of
InstantiableFromParameterSet
s from a ParameterSet
.Modifier and Type | Class and Description |
---|---|
static class |
ParameterSetParser.NotInstantiableException
An
Exception that is thrown if an instance of some class could
not be created. |
static class |
ParameterSetParser.WrongParameterTypeException
|
Constructor and Description |
---|
ParameterSetParser() |
Modifier and Type | Method and Description |
---|---|
static boolean |
getBooleanFromParameter(Parameter par)
|
static byte |
getByteFromParameter(Parameter par)
|
static double |
getDoubleFromParameter(Parameter par)
|
static float |
getFloatFromParameter(Parameter par)
|
static <T extends InstantiableFromParameterSet> |
getInstanceFromParameterSet(InstanceParameterSet<T> pars)
Returns an instance of a subclass of
InstantiableFromParameterSet
that can be instantiated by the InstanceParameterSet
pars . |
static <T extends InstantiableFromParameterSet> |
getInstanceFromParameterSet(ParameterSet pars,
Class<T> instanceClass)
Returns an instance of a subclass of
InstantiableFromParameterSet
that can be instantiated by the ParameterSet pars . |
static int |
getIntFromParameter(Parameter par)
|
static long |
getLongFromParameter(Parameter par)
|
static short |
getShortFromParameter(Parameter par)
|
static String |
getStringFromParameter(Parameter par)
|
public static int getIntFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
int
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
int
, i.e. its DataType
is not
DataType.INT
DataType
,
DataType.INT
public static float getFloatFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
float
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
float
, i.e. its DataType
is not
DataType.FLOAT
DataType
,
DataType.FLOAT
public static double getDoubleFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
double
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
double
, i.e. its DataType
is not
DataType.DOUBLE
DataType
,
DataType.DOUBLE
public static short getShortFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
short
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
short
, i.e. its DataType
is not
DataType.SHORT
DataType
,
DataType.SHORT
public static long getLongFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
long
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
long
, i.e. its DataType
is not
DataType.LONG
DataType
,
DataType.LONG
public static byte getByteFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
byte
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
byte
, i.e. its DataType
is not
DataType.BYTE
DataType
,
DataType.BYTE
public static boolean getBooleanFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
boolean
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
boolean
, i.e. its DataType
is not
DataType.BOOLEAN
DataType
,
DataType.BOOLEAN
public static String getStringFromParameter(Parameter par) throws ParameterSetParser.WrongParameterTypeException
par
- the Parameter
String
value of the Parameter
ParameterSetParser.WrongParameterTypeException
- if par
is not a Parameter
of type
String
, i.e. its DataType
is not
DataType.STRING
DataType
,
DataType.STRING
public static <T extends InstantiableFromParameterSet> T getInstanceFromParameterSet(InstanceParameterSet<T> pars) throws ParameterSetParser.NotInstantiableException
InstantiableFromParameterSet
that can be instantiated by the InstanceParameterSet
pars
. The instance class is taken from pars
via
the method InstanceParameterSet.getInstanceClass()
.T
- the type of the InstanceParameterSet
pars
- the InstanceParameterSet
ParameterSetParser.NotInstantiableException
- if InstanceParameterSet.getInstanceClass()
of
pars
is null
, could not be found or
cannot be instantiated from pars
InstanceParameterSet.getInstanceClass()
,
getInstanceFromParameterSet(ParameterSet, Class)
public static <T extends InstantiableFromParameterSet> T getInstanceFromParameterSet(ParameterSet pars, Class<T> instanceClass) throws ParameterSetParser.NotInstantiableException
InstantiableFromParameterSet
that can be instantiated by the ParameterSet
pars
.
The instance class is taken from instanceClass
.T
- the type of the InstanceParameterSet
pars
- the ParameterSet
instanceClass
- the class that shall be instantiatedParameterSetParser.NotInstantiableException
- if instanceClass
is null
, could not
be found or cannot be instantiated from pars