org.jpox.store.mapping
Class MultiMapping

java.lang.Object
  extended byorg.jpox.store.mapping.JavaTypeMapping
      extended byorg.jpox.store.mapping.MultiMapping
Direct Known Subclasses:
ReferenceMapping, SubclassPCMapping

public abstract class MultiMapping
extends JavaTypeMapping

Mapping to represent multiple mappings. This mapping can be used to represent, for example,

Version:
$Revision: 1.9 $

Field Summary
protected  DatastoreContainerObject datastoreContainer
          The datastore container storing this mapping.
protected  java.util.List javaTypeMappings
          The Java mappings represented by this mapping.
 
Fields inherited from class org.jpox.store.mapping.JavaTypeMapping
datastoreMappings, dba, fmd, LOCALISER, referenceMapping, type
 
Constructor Summary
MultiMapping(DatastoreAdapter dba, AbstractPropertyMetaData fmd, DatastoreContainerObject datastoreContainer)
          Constructor.
MultiMapping(DatastoreAdapter dba, java.lang.String type)
          Constructor.
 
Method Summary
 void addJavaTypeMapping(JavaTypeMapping mapping)
          Method to add a Java type mapping for a field
 DatastoreContainerObject getDatastoreContainer()
          Accessor for the datastore class (e.g in an RDBMS context, the Table)
 DatastoreMapping getDataStoreMapping(int index)
          Accessor for a datastore mapping.
 java.util.List getJavaTypeMapping()
          Accessor for the Java type mappings
 int getNumberOfDatastoreFields()
          Accessor for the number of datastore fields.
 java.lang.Object getObject(PersistenceManager pm, java.lang.Object rs, int[] pos)
          Method to retrieve an object of this type from the ResultSet.
 boolean includeInFetchStatement()
          Accessor for whether this mapping is to be included in any fetch statement.
 boolean includeInInsertStatement()
          Accessor for whether this mapping is to be included in the insert statement.
 boolean includeInUpdateStatement()
          Accessor for whether this mapping is to be included in the update statement.
 void setObject(PersistenceManager pm, java.lang.Object ps, int[] pos, java.lang.Object value)
          Method to set the parameters in the PreparedStatement with the fields of this object.
 void setObject(PersistenceManager pm, java.lang.Object ps, int[] pos, java.lang.Object value, StateManager ownerSM, int ownerFieldNumber)
          Sets a value into preparedStatement at position specified by exprIndex.
 
Methods inherited from class org.jpox.store.mapping.JavaTypeMapping
addDataStoreMapping, failureMessage, getBoolean, getByte, getChar, getDataStoreMappings, getDouble, getFieldMetaData, getFloat, getInt, getJavaType, getLong, getObject, getReferenceMapping, getSampleValue, getShort, getString, getType, isNullable, newLiteral, newScalarExpression, setBoolean, setByte, setChar, setDefault, setDouble, setFloat, setInt, setLong, setReferenceMapping, setShort, setString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datastoreContainer

protected DatastoreContainerObject datastoreContainer
The datastore container storing this mapping.


javaTypeMappings

protected java.util.List javaTypeMappings
The Java mappings represented by this mapping.

Constructor Detail

MultiMapping

public MultiMapping(DatastoreAdapter dba,
                    java.lang.String type)
Constructor.

Parameters:
dba - Datastore Adapter
type - Type of the field

MultiMapping

public MultiMapping(DatastoreAdapter dba,
                    AbstractPropertyMetaData fmd,
                    DatastoreContainerObject datastoreContainer)
Constructor.

Parameters:
dba - Datastore Adapter
fmd - AbstractPropertyMetaData for the field being mapped
datastoreContainer - Table containing the mapped object
Method Detail

getDatastoreContainer

public DatastoreContainerObject getDatastoreContainer()
Accessor for the datastore class (e.g in an RDBMS context, the Table)

Specified by:
getDatastoreContainer in class JavaTypeMapping
Returns:
The datastore class containing this mapped field.

addJavaTypeMapping

public void addJavaTypeMapping(JavaTypeMapping mapping)
Method to add a Java type mapping for a field

Parameters:
mapping - The mapping to add

getJavaTypeMapping

public java.util.List getJavaTypeMapping()
Accessor for the Java type mappings

Returns:
The Java type mappings

getNumberOfDatastoreFields

public int getNumberOfDatastoreFields()
Accessor for the number of datastore fields.

Overrides:
getNumberOfDatastoreFields in class JavaTypeMapping
Returns:
The number of datastore fields.

getDataStoreMapping

public DatastoreMapping getDataStoreMapping(int index)
Accessor for a datastore mapping.

Overrides:
getDataStoreMapping in class JavaTypeMapping
Parameters:
index - The position of the mapping to return
Returns:
The datastore mapping

includeInFetchStatement

public boolean includeInFetchStatement()
Accessor for whether this mapping is to be included in any fetch statement.

Specified by:
includeInFetchStatement in class JavaTypeMapping
Returns:
Whether to include this mapping in a fetch statement

includeInUpdateStatement

public boolean includeInUpdateStatement()
Accessor for whether this mapping is to be included in the update statement.

Specified by:
includeInUpdateStatement in class JavaTypeMapping
Returns:
Whether to include in update statement

includeInInsertStatement

public boolean includeInInsertStatement()
Accessor for whether this mapping is to be included in the insert statement.

Specified by:
includeInInsertStatement in class JavaTypeMapping
Returns:
Whether to include in insert statement

setObject

public void setObject(PersistenceManager pm,
                      java.lang.Object ps,
                      int[] pos,
                      java.lang.Object value)
Method to set the parameters in the PreparedStatement with the fields of this object.

Overrides:
setObject in class JavaTypeMapping
Parameters:
pm - Persistence Manager
ps - The PreparedStatement
pos - The parameter positions
value - The object to populate the statement with
Throws:
NotYetFlushedException - Thrown if the object is not yet flushed to the datastore

setObject

public void setObject(PersistenceManager pm,
                      java.lang.Object ps,
                      int[] pos,
                      java.lang.Object value,
                      StateManager ownerSM,
                      int ownerFieldNumber)
Sets a value into preparedStatement at position specified by exprIndex.

Overrides:
setObject in class JavaTypeMapping
Parameters:
pm - the PersistenceManager
ps - a datastore object that executes statements in the database
pos - the position of the value in the statement
value - the value
ownerSM - the owner StateManager
ownerFieldNumber - the owner absolute field number

getObject

public java.lang.Object getObject(PersistenceManager pm,
                                  java.lang.Object rs,
                                  int[] pos)
Method to retrieve an object of this type from the ResultSet.

Overrides:
getObject in class JavaTypeMapping
Parameters:
pm - Persistence Manager
rs - The ResultSet
pos - The parameter positions
Returns:
The object


Copyright © -2007 . All Rights Reserved.