org.jpox.store.mapping
Class CollectionMapping

java.lang.Object
  extended byorg.jpox.store.mapping.JavaTypeMapping
      extended byorg.jpox.store.mapping.SingleFieldMapping
          extended byorg.jpox.store.mapping.AbstractContainerMapping
              extended byorg.jpox.store.mapping.CollectionMapping
All Implemented Interfaces:
MappingCallbacks

public class CollectionMapping
extends AbstractContainerMapping
implements MappingCallbacks

Mapping for Collection (Set/List) types.

Version:
$Revision: 1.32 $

Field Summary
 
Fields inherited from class org.jpox.store.mapping.AbstractContainerMapping
contentsStore, contentsTable, fieldName, instantiatedType, storeMgr
 
Fields inherited from class org.jpox.store.mapping.SingleFieldMapping
datastoreContainer, typeInfo
 
Fields inherited from class org.jpox.store.mapping.JavaTypeMapping
datastoreMappings, dba, fmd, LOCALISER, referenceMapping, type
 
Constructor Summary
CollectionMapping(DatastoreAdapter dba, AbstractPropertyMetaData fmd, DatastoreContainerObject datastoreContainer, ClassLoaderResolver clr)
          Constructor.
CollectionMapping(DatastoreAdapter dba, java.lang.String type)
          Constructor taking the database adapter representing the datastore being used and the class of the mapping.
 
Method Summary
 void deleteDependent(StateManager sm)
          Method to delete all dependent objects (the contents of the Collection).
 boolean equals(java.lang.Object obj)
          Equality operator.
 CollectionStore getBackingStore(ClassLoaderResolver clr)
          Accessor for the Store of the contents.
 java.lang.Class getJavaType()
          Accessor for the Java type represented here.
 ScalarExpression newLiteral(QueryExpression qs, java.lang.Object value)
          Accessor for a literal representing this type.
 ScalarExpression newScalarExpression(QueryExpression qs, LogicSetExpression te)
          Accessor for a scalar expression involving this object.
 void postInsert(StateManager sm)
          Method to be called after the insert of the owner class element.
 void postUpdate(StateManager sm)
          Method to be called after any update of the owner class element.
 void preDelete(StateManager sm)
          Method to be called before any delete of the owner class element.
 
Methods inherited from class org.jpox.store.mapping.AbstractContainerMapping
containerIsStoredInSingleColumn, getDatastoreContainer, getDataStoreMapping, getDataStoreMappings, getNumberOfDatastoreFields, getObject, getSampleValue, hashCode, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, newWrapper, postFetch, prepareDatastoreMapping, setObject, validateElementForWriting, validateElementsForWriting
 
Methods inherited from class org.jpox.store.mapping.SingleFieldMapping
getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getShort, getString, hasValue, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString
 
Methods inherited from class org.jpox.store.mapping.JavaTypeMapping
addDataStoreMapping, failureMessage, getFieldMetaData, getObject, getReferenceMapping, getType, isNullable, setDefault, setObject, setReferenceMapping
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jpox.store.mapping.MappingCallbacks
postFetch
 

Constructor Detail

CollectionMapping

public CollectionMapping(DatastoreAdapter dba,
                         java.lang.String type)
Constructor taking the database adapter representing the datastore being used and the class of the mapping.

Parameters:
dba - Database adapter
type - Java class being mapped to the DB

CollectionMapping

public CollectionMapping(DatastoreAdapter dba,
                         AbstractPropertyMetaData fmd,
                         DatastoreContainerObject datastoreContainer,
                         ClassLoaderResolver clr)
Constructor.

Parameters:
dba - Datastore adapter
fmd - Field metadata for the field
datastoreContainer - The owner table
clr - The ClassLoaderResolver
Method Detail

getBackingStore

public CollectionStore getBackingStore(ClassLoaderResolver clr)
Accessor for the Store of the contents.

Parameters:
clr - The ClassLoaderResolver
Returns:
The backing store

equals

public boolean equals(java.lang.Object obj)
Equality operator.

Overrides:
equals in class SingleFieldMapping
Parameters:
obj - Object to compare against
Returns:
Whether they are equal

getJavaType

public java.lang.Class getJavaType()
Accessor for the Java type represented here.

Specified by:
getJavaType in class JavaTypeMapping
Returns:
The java type

postInsert

public void postInsert(StateManager sm)
Method to be called after the insert of the owner class element.

Specified by:
postInsert in interface MappingCallbacks
Parameters:
sm - StateManager of the owner

postUpdate

public void postUpdate(StateManager sm)
Method to be called after any update of the owner class element.

Specified by:
postUpdate in interface MappingCallbacks
Parameters:
sm - StateManager of the owner

preDelete

public void preDelete(StateManager sm)
Method to be called before any delete of the owner class element.

Specified by:
preDelete in interface MappingCallbacks
Parameters:
sm - StateManager of the owner

deleteDependent

public void deleteDependent(StateManager sm)
Method to delete all dependent objects (the contents of the Collection).

Specified by:
deleteDependent in interface MappingCallbacks
Parameters:
sm - State Manager of the owner

newLiteral

public ScalarExpression newLiteral(QueryExpression qs,
                                   java.lang.Object value)
Accessor for a literal representing this type.

Specified by:
newLiteral in class JavaTypeMapping
Parameters:
qs - The Query
value - the value of this object in the literal
Returns:
The literal

newScalarExpression

public ScalarExpression newScalarExpression(QueryExpression qs,
                                            LogicSetExpression te)
Accessor for a scalar expression involving this object.

Specified by:
newScalarExpression in class JavaTypeMapping
Parameters:
qs - The Query
te - The table holding this object.
Returns:
The expression


Copyright © -2007 . All Rights Reserved.