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

## oracle.jbo.domain
Class TypeFactory

    java.lang.Object
      |
      +--oracle.jbo.domain.TypeFactory

public class TypeFactory
extends java.lang.Object

Internal: Applications should not extend this class or invoke its methods.

A utility for creating immutable Domain objects.

Create a Domain object by passing a fully qualified classname and a compatable data value to a `getInstance` method. The classname may be a expressed as a `Class` or as a `String`.

. The data value may be an `Object` or a value of any of the primitive data types.

Note that for non-String data types that do not have String constructors or that throw exceptions for empty strings ("") from their constructor or valueOf() methods, this factory assumes the value to be NULL value. So for example if an attribute is of type Number and setAttribute() is called for that attribute with a "" (empty string), the value for the attribute will be set to NULL. This helps all thin-clients to share the same logic of setting NULL values and provide similar behaviour without special-casing for "" strings. This behavior can be overruled by creating a domain for the desired data-type that has a string constructor or a valueOf(String) method that could accept "" (empty string) and convert that to some default value;

Since:
  JDevloper 3.0

Constructor Summary
`TypeFactory()`

Method Summary
`static java.lang.Object` | `getInstance(java.lang.Class clazz, boolean val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, byte val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, char val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class domainClass, java.lang.Class param, java.lang.Object val)` Incase, a constructor in the class of type domainClass does not take one argument of type same as `val`, use the class given by `param` to find the constructor, assuming that `val` is convertible to an object of `param` class.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, double val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, float val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, int val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, long val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, java.lang.Object val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.Class clazz, short val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, boolean val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, byte val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, char val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, double val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, float val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, int val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, long val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String clazz, java.lang.Object val)` Creates an object of type `clazz` having the value
`static java.lang.Object` | `getInstance(java.lang.String clazz, short val)` Creates an object of type `clazz` having the value `val`.
`static java.lang.Object` | `getInstance(java.lang.String domainClass, java.lang.String param, java.lang.Object val)` Incase, a constructor in the class of type domainClass does not take one argument of type same as `val`, use the class given by `param` to find the constructor, assuming that `val` is convertible to an object of `param` class.

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

Constructor Detail

### TypeFactory

    public TypeFactory()

Method Detail

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               java.lang.Object val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - An object.
  Returns:
    An object consisting of `val` converted to `clazz`. If `val` is `null` or already of type `clazz` then `val` itself is returned.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String domainClass,
                                               java.lang.String param,
                                               java.lang.Object val)

  Incase, a constructor in the class of type domainClass does not take one argument of type same as `val`, use the class given by `param` to find the constructor, assuming that `val` is convertible to an object of `param` class.
  Parameters:
    `domainClass` - full qualified classname of the target object
    `param` - full qualified classname of the parameter
    `val` - value to convert into the domainClass type.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class domainClass,
                                               java.lang.Class param,
                                               java.lang.Object val)

  Incase, a constructor in the class of type domainClass does not take one argument of type same as `val`, use the class given by `param` to find the constructor, assuming that `val` is convertible to an object of `param` class.
  Parameters:
    `domainClass` - Preferred Class type of the target object
    `param` - Class type of the parameter
    `val` - value to convert into the domainClass type.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               int val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 32-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               short val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 32-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               long val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 64-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               float val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 32-bit floating-point value.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               double val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 64-bit floating-point value.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               byte val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - An 8-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               boolean val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - `true` or `false`.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.Class clazz,
                                               char val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A unicode character.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               java.lang.Object val)

  Creates an object of type `clazz` having the value
  Parameters:
    `clazz` - A fully qualified classname. `val`.
    `val` - An object.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               int val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 32-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               short val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 16-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               long val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 64-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               float val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 32-bit floating-point value.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               double val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A 64-bit floating-point value.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               byte val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - An 8-bit signed integer.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               boolean val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - `true` or `false`.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

### getInstance

    public static java.lang.Object getInstance(java.lang.String clazz,
                                               char val)

  Creates an object of type `clazz` having the value `val`.
  Parameters:
    `clazz` - A fully qualified classname.
    `val` - A unicode character.
  Returns:
    An object consisting of `val` converted to `clazz`.
  Throws:
    DataCreationException - if `val` is incompatable with `clazz`.

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