Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.io
Class ParameterSetParser

    java.lang.Object
      de.jstacs.io.ParameterSetParser

    public class ParameterSetParser

extends Object

Class that extracts values from `Parameter`s and creates instances of `InstantiableFromParameterSet`s from a `ParameterSet`.

Author:
  Jan Grau

Nested Class Summary
`static class` | `ParameterSetParser.NotInstantiableException` An `Exception` that is thrown if an instance of some class could not be created.
`static class` | `ParameterSetParser.WrongParameterTypeException` An `Exception` that is thrown if the `DataType` of a `Parameter` is not appropriate for some purpose.

Constructor Summary
`ParameterSetParser()`

Method Summary
`static boolean` | `getBooleanFromParameter(Parameter par)` Returns the `boolean` which is the value of the `Parameter` `par`.
`static byte` | `getByteFromParameter(Parameter par)` Returns the `byte` which is the value of the `Parameter` `par`.
`static double` | `getDoubleFromParameter(Parameter par)` Returns the `double` which is the value of the `Parameter` `par`.
`static float` | `getFloatFromParameter(Parameter par)` Returns the `float` which is the value of the `Parameter` `par`.
`static InstantiableFromParameterSet` | `getInstanceFromParameterSet(InstanceParameterSet pars)` Returns an instance of a subclass of `InstantiableFromParameterSet` that can be instantiated by the `InstanceParameterSet` `pars`.
`static InstantiableFromParameterSet` | `getInstanceFromParameterSet(ParameterSet pars, Class instanceClass)` Returns an instance of a subclass of `InstantiableFromParameterSet` that can be instantiated by the `ParameterSet` `pars`.
`static int` | `getIntFromParameter(Parameter par)` Returns the `int` which is the value of the `Parameter` `par`.
`static long` | `getLongFromParameter(Parameter par)` Returns the `long` which is the value of the `Parameter` `par`.
`static short` | `getShortFromParameter(Parameter par)` Returns the `short` which is the value of the `Parameter` `par`.
`static String` | `getStringFromParameter(Parameter par)` Returns the `String` which is the value of the `Parameter` `par`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ParameterSetParser

    public ParameterSetParser()

Method Detail

### getIntFromParameter

    public static int getIntFromParameter(Parameter par)
                                   throws ParameterSetParser.WrongParameterTypeException

  Returns the `int` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `int` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `int`-`Parameter`, i.e. its `DataType` is not `DataType.INT`

### getFloatFromParameter

    public static float getFloatFromParameter(Parameter par)
                                       throws ParameterSetParser.WrongParameterTypeException

  Returns the `float` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `float` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `float`-`Parameter`, i.e. its `DataType` is not `DataType.FLOAT`

### getDoubleFromParameter

    public static double getDoubleFromParameter(Parameter par)
                                         throws ParameterSetParser.WrongParameterTypeException

  Returns the `double` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `double` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `double`-`Parameter`, i.e. its `DataType` is not `DataType.DOUBLE`

### getShortFromParameter

    public static short getShortFromParameter(Parameter par)
                                       throws ParameterSetParser.WrongParameterTypeException

  Returns the `short` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `short` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `short`-`Parameter`, i.e. its `DataType` is not`DataType.SHORT`

### getLongFromParameter

    public static long getLongFromParameter(Parameter par)
                                     throws ParameterSetParser.WrongParameterTypeException

  Returns the `long` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `long` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `long`-`Parameter`, i.e. its `DataType` is not `DataType.LONG`

### getByteFromParameter

    public static byte getByteFromParameter(Parameter par)
                                     throws ParameterSetParser.WrongParameterTypeException

  Returns the `byte` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `byte` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `byte`-`Parameter`, i.e. its `DataType` is not `DataType.BYTE`

### getBooleanFromParameter

    public static boolean getBooleanFromParameter(Parameter par)
                                           throws ParameterSetParser.WrongParameterTypeException

  Returns the `boolean` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `boolean` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `boolean`-`Parameter`, i.e. its `DataType` is not `DataType.BOOLEAN`

### getStringFromParameter

    public static String getStringFromParameter(Parameter par)
                                         throws ParameterSetParser.WrongParameterTypeException

  Returns the `String` which is the value of the `Parameter` `par`.

  Parameters:
    `par` - the `Parameter`
  Returns:
    the `String` value
  Throws:
    `ParameterSetParser.WrongParameterTypeException` - is thrown if `par` is not an `String`-`Parameter`, i.e. its `DataType` is not `DataType.STRING`

### getInstanceFromParameterSet

    public static InstantiableFromParameterSet getInstanceFromParameterSet(InstanceParameterSet pars)
                                                                    throws ParameterSetParser.NotInstantiableException

  Returns an instance of a subclass of `InstantiableFromParameterSet` that can be instantiated by the `InstanceParameterSet` `pars`. The instance-class is taken from `pars` via the `InstanceParameterSet.getInstanceClass()`.

  Parameters:
    `pars` - the `InstanceParameterSet`
  Returns:
    the instance
  Throws:
    `ParameterSetParser.NotInstantiableException` - thrown if `InstanceParameterSet.getInstanceClass()` of `pars` is `null`, could not be found or cannot be instantiated from `pars`

### getInstanceFromParameterSet

    public static InstantiableFromParameterSet getInstanceFromParameterSet(ParameterSet pars,
                                                                           Class instanceClass)
                                                                    throws ParameterSetParser.NotInstantiableException

  Returns an instance of a subclass of `InstantiableFromParameterSet` that can be instantiated by the `ParameterSet` `pars`. The instance-class is taken from `instanceClass`.

  Parameters:
    `pars` - the `ParameterSet`
    `instanceClass` - the class that shall be instantiated
  Returns:
    the instance
  Throws:
    `ParameterSetParser.NotInstantiableException` - thrown if `instanceClass` could not be found or cannot be instantiated from `pars`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD