de.vc.util

## Class ValueFactory

- java.lang.Object
- - de.vc.util.ValueFactory

-     public class ValueFactory
      extends java.lang.Object

  The ValueFactory creates values (Objects) from various representation such as Strings, and backwards.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `createString(java.lang.Object obj)` Creates a String-Representation of a value (object).
    `java.lang.String` | `createStringForced(java.lang.Object o)` Creates a String-Representation of a value (object).
    `java.lang.Object` | `createValue(java.lang.Class clazz, java.lang.Object rep)` Creates a new value (Object) from a String-Representation.
    `ValueManufacturer` | `getManufacturer(java.lang.Class type)` Gets a registered Manufacturer of a special type (class).
    `static ValueFactory` | `instance()` Gets the default instance of ValueFactory.
    `void` | `register(ValueManufacturer manufacturer)` Registers a ValueManufacturer that is responsible for only one type (class) of values (objects).
    `void` | `unregister(ValueManufacturer manufacturer)` Unregisters a ValueManufacturer that is responsible for only one type (class) of values (objects).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### instance

          public static ValueFactory instance()

      Gets the default instance of ValueFactory. ValueManufactors for String, Integer, Long, Boolean, Double, Float are registered.
      Returns:
        ValueFactory

    - #### createValue

          public java.lang.Object createValue(java.lang.Class clazz,
                                     java.lang.Object rep)

      Creates a new value (Object) from a String-Representation.
      Parameters:
        `clazz` - Class of value (Object).
        `rep` - Representation.
      Returns:
        New value or NULL, if nor manufacturer registered.

    - #### createString

          public java.lang.String createString(java.lang.Object obj)
                                        throws UnknownManufacturerException

      Creates a String-Representation of a value (object). This can be another String than value.toString().
      Parameters:
        `obj` - Object.
      Returns:
        String-Representation or NULL, if no manufacturer registered.
      Throws:
        `UnknownManufacturerException`

    - #### createStringForced

          public java.lang.String createStringForced(java.lang.Object o)

      Creates a String-Representation of a value (object). If no manufacturer is defined for objects class, object.toString() is returned.
      Parameters:
        `o` - Object.
      Returns:
        String-Representation.

    - #### register

          public void register(ValueManufacturer manufacturer)

      Registers a ValueManufacturer that is responsible for only one type (class) of values (objects).
      Parameters:
        `manufacturer` - Manufacturer.

    - #### unregister

          public void unregister(ValueManufacturer manufacturer)

      Unregisters a ValueManufacturer that is responsible for only one type (class) of values (objects).
      Parameters:
        `manufacturer` - Manufacturer.

    - #### getManufacturer

          public ValueManufacturer getManufacturer(java.lang.Class type)

      Gets a registered Manufacturer of a special type (class).
      Parameters:
        `type` - Type.
      Returns:
        ValueManufacturer.

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.