org.datanucleus.store.mapped.mapping
Class MappingHelper

java.lang.Object
  extended by org.datanucleus.store.mapped.mapping.MappingHelper

public class MappingHelper
extends Object

Helper class for handling mappings.


Field Summary
protected static Localiser LOCALISER
          Localiser for messages
 
Constructor Summary
MappingHelper()
           
 
Method Summary
protected static Object createObjectIdInstanceReflection(ExecutionContext ec, JavaTypeMapping mapping, Object rs, int[] param, AbstractClassMetaData cmd, Class objectIdClass)
          Create an object id instance and fill the fields using reflection
protected static Object createSingleFieldIdentity(ExecutionContext ec, JavaTypeMapping mapping, Object rs, int[] param, AbstractClassMetaData cmd, Class objectIdClass, Class pcClass)
          Create a SingleFieldIdentity instance
static int[] getMappingIndices(int initialPosition, JavaTypeMapping mapping)
          Convenience method to return an array of positions for datastore columns for the supplied mapping and the initial position value.
protected static Object getObjectForAbstractClass(ExecutionContext ec, JavaTypeMapping mapping, Object rs, int[] resultIndexes, AbstractClassMetaData cmd)
          Create an object id instance and fill the fields using reflection
static Object getObjectForApplicationIdentity(ExecutionContext ec, JavaTypeMapping mapping, Object rs, int[] resultIndexes, AbstractClassMetaData cmd)
          Get the object instance for a class using application identity
static Object getObjectForDatastoreIdentity(ExecutionContext ec, JavaTypeMapping mapping, Object rs, int[] resultIndexes, AbstractClassMetaData cmd)
          Get the object instance for a class using datastore identity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages

Constructor Detail

MappingHelper

public MappingHelper()
Method Detail

getMappingIndices

public static int[] getMappingIndices(int initialPosition,
                                      JavaTypeMapping mapping)
Convenience method to return an array of positions for datastore columns for the supplied mapping and the initial position value. For example if the mapping has a single datastore column and the initial position is 1 then returns the array {1}.

Parameters:
initialPosition - the initialPosition
mapping - the Mapping
Returns:
an array containing indexes for parameters

getObjectForDatastoreIdentity

public static Object getObjectForDatastoreIdentity(ExecutionContext ec,
                                                   JavaTypeMapping mapping,
                                                   Object rs,
                                                   int[] resultIndexes,
                                                   AbstractClassMetaData cmd)
Get the object instance for a class using datastore identity

Parameters:
ec - ExecutionContext
mapping - The mapping in which this is returned
rs - the ResultSet
resultIndexes - indexes for the result set
cmd - the AbstractClassMetaData
Returns:
the id

getObjectForApplicationIdentity

public static Object getObjectForApplicationIdentity(ExecutionContext ec,
                                                     JavaTypeMapping mapping,
                                                     Object rs,
                                                     int[] resultIndexes,
                                                     AbstractClassMetaData cmd)
Get the object instance for a class using application identity

Parameters:
ec - ExecutionContext
mapping - The mapping in which this is returned
rs - the ResultSet
resultIndexes - indexes in the result set to retrieve
cmd - the AbstractClassMetaData
Returns:
the id

createSingleFieldIdentity

protected static Object createSingleFieldIdentity(ExecutionContext ec,
                                                  JavaTypeMapping mapping,
                                                  Object rs,
                                                  int[] param,
                                                  AbstractClassMetaData cmd,
                                                  Class objectIdClass,
                                                  Class pcClass)
Create a SingleFieldIdentity instance

Parameters:
ec - ExecutionContext
mapping - Mapping in which this is returned
rs - the ResultSet
param - the parameters
cmd - the AbstractClassMetaData
objectIdClass - the object id class
pcClass - the PersistenceCapable class
Returns:
the id

createObjectIdInstanceReflection

protected static Object createObjectIdInstanceReflection(ExecutionContext ec,
                                                         JavaTypeMapping mapping,
                                                         Object rs,
                                                         int[] param,
                                                         AbstractClassMetaData cmd,
                                                         Class objectIdClass)
Create an object id instance and fill the fields using reflection

Parameters:
ec - ExecutionContext
mapping - Mapping in which this is returned
rs - the ResultSet
param - the parameters
cmd - the AbstractClassMetaData
objectIdClass - the object id class
Returns:
the id

getObjectForAbstractClass

protected static Object getObjectForAbstractClass(ExecutionContext ec,
                                                  JavaTypeMapping mapping,
                                                  Object rs,
                                                  int[] resultIndexes,
                                                  AbstractClassMetaData cmd)
Create an object id instance and fill the fields using reflection

Parameters:
ec - ExecutionContext
mapping - Mapping in which this is returned
rs - the ResultSet
resultIndexes - indexes of the result set to use
cmd - the AbstractClassMetaData
Returns:
the id


Copyright © 2012. All Rights Reserved.