org.apache.ojb.broker
Interface IdentityFactory

All Known Implementing Classes:
IdentityFactoryImpl

public interface IdentityFactory

Builds Identity objects to identify persistence capable objects within OJB. In many cases the primary key (based on metadata declaration) of an object is known and the whole object should be materialized (e.g. findByPrimaryKey(...) calls). This class make available a bunch of methods help to create Identity objects based on

NOTE:
It is possible to create transient Identity objects for transient, "new created" persistence capable objects. But keep in mind that this transient Identity object is only valid till the persistence capable object was written to datastore. After this the Identity have to be renewed by calling IdentityFactory.buildIdentity(...) again (then the transient Identity will be replaced by the persistent Identity).

Version:
$Id: IdentityFactory.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $

Method Summary
 Identity buildIdentity(Class realClass, Class topLevelClass, Object[] pkValues)
          Create a new Identity object based on given arguments - NOTE: There will be no check to resolve the order of the PK values.
 Identity buildIdentity(Class realClass, Class topLevelClass, String[] pkFieldName, Object[] pkValues)
          Build a unique Identity for the given primary key values (composite PK's) of a persistence capable object.
 Identity buildIdentity(ClassDescriptor cld, Object obj)
          Build a unique Identity for the given persistence capable object.
 Identity buildIdentity(Class realClass, Object pkValue)
          Convenience method for persistent objects with single primary key.
 Identity buildIdentity(Class realClass, String[] pkFieldName, Object[] pkValues)
          Convenience shortcut method for buildIdentity(java.lang.Class, java.lang.Class, java.lang.String[], java.lang.Object[]).
 Identity buildIdentity(Object obj)
          Build a unique Identity for the given persistence capable object.
 

Method Detail

buildIdentity

Identity buildIdentity(Object obj)
Build a unique Identity for the given persistence capable object.

Parameters:
obj - The object to build the Identity for
Returns:
The new Identity object

buildIdentity

Identity buildIdentity(ClassDescriptor cld,
                       Object obj)
Build a unique Identity for the given persistence capable object.

Parameters:
cld - The ClassDescriptor of the object
obj - The object to build the Identity for
Returns:
The new Identity object.

buildIdentity

Identity buildIdentity(Class realClass,
                       Class topLevelClass,
                       String[] pkFieldName,
                       Object[] pkValues)
Build a unique Identity for the given primary key values (composite PK's) of a persistence capable object.

Parameters:
realClass - The class of the associated object
topLevelClass - The top-level class of the associated object
pkFieldName - The field names of the PK fields
pkValues - The PK values
Returns:
The new Identity object

buildIdentity

Identity buildIdentity(Class realClass,
                       String[] pkFieldName,
                       Object[] pkValues)
Convenience shortcut method for buildIdentity(java.lang.Class, java.lang.Class, java.lang.String[], java.lang.Object[]).

Parameters:
realClass - The class of the associated object
pkFieldName - The field names of the PK fields
pkValues - The PK values
Returns:
The new Identity object

buildIdentity

Identity buildIdentity(Class realClass,
                       Object pkValue)
Convenience method for persistent objects with single primary key. NOTE: Do not use for objects with composed PK!

Parameters:
realClass - The class of the associated object
pkValue - The PK value
Returns:
The new Identity object
See Also:
buildIdentity(java.lang.Class, java.lang.String[], java.lang.Object[])

buildIdentity

Identity buildIdentity(Class realClass,
                       Class topLevelClass,
                       Object[] pkValues)
Create a new Identity object based on given arguments - NOTE: There will be no check to resolve the order of the PK values. This method expect the correct order based on the declaration of the FieldDescriptor in the mapping file.

Parameters:
realClass - The class of the associated object
topLevelClass - The top-level class of the associated object
pkValues - The PK values
Returns:
The new Identity object


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.