org.datanucleus.store.mapped.mapping
Class ArrayMapping

java.lang.Object
  extended by org.datanucleus.store.mapped.mapping.JavaTypeMapping
      extended by org.datanucleus.store.mapped.mapping.SingleFieldMapping
          extended by org.datanucleus.store.mapped.mapping.AbstractContainerMapping
              extended by org.datanucleus.store.mapped.mapping.ArrayMapping
All Implemented Interfaces:
MappingCallbacks

public class ArrayMapping
extends AbstractContainerMapping
implements MappingCallbacks

Mapping for an array.


Field Summary
 
Fields inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
datastoreContainer, datastoreMappings, LOCALISER, mmd, referenceMapping, roleForMember, storeMgr, type
 
Constructor Summary
ArrayMapping()
           
 
Method Summary
protected  boolean containerIsStoredInSingleColumn()
          Convenience method to return if the array is stored in the owning table as a column.
 java.lang.Class getJavaType()
          Accessor for the Java type represented here.
 java.lang.Object getSampleValue(ClassLoaderResolver clr)
          Accessor for a sample value for this mapping.
 void insertPostProcessing(StateManager sm)
          Hook so that we can handle any post-processing on the insert of a particular field.
 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 postFetch(StateManager sm)
          Method to be called after any fetch of the owner class element.
 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, if the field in the owner is dependent
 
Methods inherited from class org.datanucleus.store.mapped.mapping.AbstractContainerMapping
getDatastoreContainer, getDatastoreMapping, getDatastoreMappings, getJavaTypeForDatastoreMapping, getNumberOfDatastoreMappings, getObject, hasSimpleDatastoreRepresentation, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, initialize, prepareDatastoreMapping, replaceFieldWithWrapper, setObject
 
Methods inherited from class org.datanucleus.store.mapped.mapping.SingleFieldMapping
equals, getBoolean, getByte, getChar, getDefaultLength, getDouble, getFloat, getInt, getLong, getShort, getString, getValidValues, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString
 
Methods inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
addDatastoreMapping, failureMessage, getColumnMetaDataForMember, getMemberMetaData, getObject, getReferenceMapping, getRoleForMember, getType, getValueForDatastoreMapping, hashCode, initialize, isNullable, isSerialised, setDatastoreContainer, setDefault, setMemberMetaData, setObject, setReferenceMapping, setRoleForMember
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayMapping

public ArrayMapping()
Method Detail

getJavaType

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

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

containerIsStoredInSingleColumn

protected boolean containerIsStoredInSingleColumn()
Convenience method to return if the array is stored in the owning table as a column. Overrides the superclass since arrays can be stored in a single column also when the no join is specified and the array is of a primitive/wrapper type.

Overrides:
containerIsStoredInSingleColumn in class AbstractContainerMapping
Returns:
Whether it is stored in a single column in the main table.

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

insertPostProcessing

public void insertPostProcessing(StateManager sm)
Description copied from interface: MappingCallbacks
Hook so that we can handle any post-processing on the insert of a particular field. For example with Oracle we need to insert "EMPTY_CLOB" and then immediately after do a SELECT of it and update the contents of the CLOB/BLOB.

Specified by:
insertPostProcessing in interface MappingCallbacks
Parameters:
sm - StateManager

postFetch

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

Specified by:
postFetch in interface MappingCallbacks
Overrides:
postFetch in class AbstractContainerMapping
Parameters:
sm - StateManager of the owner

postUpdate

public void postUpdate(StateManager sm)
Method to be called after any update of the owner class element. This method could be called in two situations

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, if the field in the owner is dependent

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

getSampleValue

public java.lang.Object getSampleValue(ClassLoaderResolver clr)
Description copied from class: AbstractContainerMapping
Accessor for a sample value for this mapping.

Overrides:
getSampleValue in class AbstractContainerMapping
Parameters:
clr - ClassLoader resolver
Returns:
The sample value

newLiteral

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

Overrides:
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.

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


Copyright © 2010. All Rights Reserved.