public class DataObjectFactory
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
DataObjectFactory.DtoInvocationHandler
The handler which delegates the calls unimplemented method in a DTO abstract class to a DMO instance
it receives as parameter.
|
Constructor and Description |
---|
DataObjectFactory() |
Modifier and Type | Method and Description |
---|---|
<T extends DataModelObject> |
createDMO(java.lang.Class<T> clazz)
Creates a new instance of a DMO.
|
<T extends DataModelObject> |
createDMO(java.lang.Class<T> clazz,
boolean init,
boolean defs,
java.lang.Long pk)
Creates a new instance of a DMO.
|
<T extends DataModelObject> |
createDMO(java.lang.Class<T> clazz,
java.lang.Long pk)
Creates a new instance of a DMO.
|
static <T extends DataModelObject> |
createDTO(java.lang.Class<T> clazz,
DataModelObject dmo)
Creates a new instance of a DTO which implements a DMO interface in order to reuse the code of its
implementation.
|
static DataObjectFactory |
getInstance(Session session) |
private Session session
public static DataObjectFactory getInstance(Session session)
public <T extends DataModelObject> T createDMO(java.lang.Class<T> clazz)
T
- The generic type of the object to be created. Inferred from clazz
parameter.clazz
- The interface of the DMO object to be created.public <T extends DataModelObject> T createDMO(java.lang.Class<T> clazz, java.lang.Long pk)
T
- The generic type of the object to be created. Inferred from clazz
parameter.clazz
- The interface of the DMO object to be created.pk
- If not null
, the value is used as private key for the newly created record.public <T extends DataModelObject> T createDMO(java.lang.Class<T> clazz, boolean init, boolean defs, java.lang.Long pk)
T
- The generic type of the object to be created. Inferred from clazz
parameter.clazz
- The interface of the DMO object to be created.init
- If true
, the returned object is initialized (registered with the session
,
a change set and internal state are prepared) for complex usage of the object. defs
- Valid only if init
is true. Sets the default values for fields as the record was
defined with INITIAL value in table definition. pk
- If not null
, the value is used as private key for the newly created record.public static <T extends DataModelObject> T createDTO(java.lang.Class<T> clazz, DataModelObject dmo)
dmo
instance) and must not declare any abstract methods (that is, all method it
declares must be implemented, otherwise these calls will fail).T
- The DTO class of the object to be returned.clazz
- The type (abstract class) of the object to be returned.dmo
- An instance of the DMO interface to which the calls to 'super' class will be delegated.