|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.7.0) E10653-08 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jbo.domain.TypeFactory
public class TypeFactory
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;
Constructor Summary | |
---|---|
TypeFactory()
|
Method Summary | |
---|---|
static void |
addCustomConverter(java.lang.Class domainClass,
java.lang.Class paramClass,
TypeConvMapEntry mth)
|
static void |
addStaticConverter(java.lang.Class domainClass,
java.lang.Class paramClass,
int opId)
|
static void |
addStaticConverterByName(java.lang.String toClassName,
java.lang.String fromClassName,
int opId)
|
static void |
addStaticConverterByName(java.lang.String toClassName,
java.lang.String fromClassName,
int opId,
java.lang.String fromPattern)
|
static boolean |
checkEquals(java.lang.Object srcValue,
java.lang.Object targetValue)
|
static java.lang.Object |
convertAttributeValue(AttributeDef adef,
java.lang.Object value,
int defType,
java.lang.String defFullName)
Deprecated. since 10.1.3 use convertAttributeValueToType(); |
static java.lang.Object |
convertAttributeValueToType(AttributeDef adef,
java.lang.Class type,
java.lang.Object value,
int defType,
java.lang.String defFullName)
|
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,
java.lang.Object val,
boolean anotherInstance)
Creates an object of type clazz from 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. |
static TypeSQLNative |
getTypeSQLNative(java.lang.Class theJavaType,
int sqlType)
|
static java.lang.Class |
getValueSerializerClass(java.lang.Class javaType)
Gets the default value serializer class for the specified type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeFactory()
Method Detail |
---|
public static java.lang.Object getInstance(java.lang.Class clazz, java.lang.Object val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- An object.
val
converted to
clazz
. If val
is null
or already of
type clazz
then val
itself is returned.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, java.lang.Object val, boolean anotherInstance)
clazz
from the value
val
. If the value is an instance of the class, try
to create a copy of the val and return the copy.
clazz
- A fully qualified classname.val
- An object.anotherInstance
- If the value matches the required type, create
a copy if this parameter is true.
val
converted to
clazz
. If val
is null
or already of
type clazz
then val
itself is returned.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String domainClass, java.lang.String param, java.lang.Object val)
val
, use the class given by
param
to find the constructor, assuming that val
is convertible to an object of param
class.
domainClass
- full qualified classname of the target objectparam
- full qualified classname of the parameterval
- value to convert into the domainClass type.public static java.lang.Object getInstance(java.lang.Class domainClass, java.lang.Class param, java.lang.Object val)
val
, use the class given by
param
to find the constructor, assuming that val
is convertible to an object of param
class.
domainClass
- Preferred Class type of the target objectparam
- Class type of the parameterval
- value to convert into the domainClass type.public static java.lang.Object getInstance(java.lang.Class clazz, int val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 32-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, short val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 32-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, long val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 64-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, float val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 32-bit floating-point value.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, double val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 64-bit floating-point value.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, byte val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- An 8-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, boolean val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- true
or false
.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.Class clazz, char val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A unicode character.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, java.lang.Object val)
clazz
having the value
clazz
- A fully qualified classname.
val
.val
- An object.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, int val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 32-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, short val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 16-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, long val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 64-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, float val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 32-bit floating-point value.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, double val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A 64-bit floating-point value.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, byte val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- An 8-bit signed integer.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, boolean val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- true
or false
.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static java.lang.Object getInstance(java.lang.String clazz, char val)
clazz
having the value
val
.
clazz
- A fully qualified classname.val
- A unicode character.
val
converted to
clazz
.
DataCreationException
- if val
is incompatable with
clazz
.public static TypeSQLNative getTypeSQLNative(java.lang.Class theJavaType, int sqlType)
public static boolean checkEquals(java.lang.Object srcValue, java.lang.Object targetValue)
public static void addStaticConverter(java.lang.Class domainClass, java.lang.Class paramClass, int opId)
public static void addStaticConverterByName(java.lang.String toClassName, java.lang.String fromClassName, int opId)
public static void addStaticConverterByName(java.lang.String toClassName, java.lang.String fromClassName, int opId, java.lang.String fromPattern)
public static void addCustomConverter(java.lang.Class domainClass, java.lang.Class paramClass, TypeConvMapEntry mth)
public static java.lang.Object convertAttributeValueToType(AttributeDef adef, java.lang.Class type, java.lang.Object value, int defType, java.lang.String defFullName)
public static java.lang.Object convertAttributeValue(AttributeDef adef, java.lang.Object value, int defType, java.lang.String defFullName)
public static java.lang.Class getValueSerializerClass(java.lang.Class javaType)
javaType
- the attribute type
null
if
there's no default value serializer.
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.7.0) E10653-08 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |