Package org.apache.openjpa.kernel
Class AbstractPCData
- java.lang.Object
-
- org.apache.openjpa.kernel.AbstractPCData
-
- All Implemented Interfaces:
java.io.Serializable
,PCData
- Direct Known Subclasses:
PCDataImpl
public abstract class AbstractPCData extends java.lang.Object implements PCData
Abstract base class which implements core PCData behavior.- Author:
- Patrick Linskey, Abe White
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Object
NULL
-
Constructor Summary
Constructors Constructor Description AbstractPCData()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.BitSet
getLoaded()
Return the loaded field mask.boolean
isLoaded(int field)
Whether the given field index has stored data.abstract AbstractPCData
newEmbeddedPCData(OpenJPAStateManager sm)
Create a new pcdata for holding the state of an embedded instance.protected java.lang.Object
toData(FieldMetaData fmd, java.lang.Object val, StoreContext ctx)
Transform the given field value to a data value for caching.protected java.lang.Object
toEmbeddedData(java.lang.Object val, StoreContext ctx)
Return the value to cache for the given embedded PC.protected java.lang.Object
toEmbeddedField(OpenJPAStateManager sm, ValueMetaData vmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data into an embedded PC field value.protected java.lang.Object
toField(OpenJPAStateManager sm, FieldMetaData fmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data value into its field value.protected java.lang.Object
toNestedData(ValueMetaData vmd, java.lang.Object val, StoreContext ctx)
Transform the given nested value to a cachable value.protected java.lang.Object
toNestedField(OpenJPAStateManager sm, ValueMetaData vmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data value to its field value.protected java.util.Collection
toNestedFields(OpenJPAStateManager sm, ValueMetaData vmd, java.util.Collection data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data value to its field value.protected java.lang.Object
toRelationData(java.lang.Object val, StoreContext ctx)
Return the value to cache for the given object.protected java.lang.Object
toRelationField(OpenJPAStateManager sm, ValueMetaData vmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data into a relation field value.protected java.lang.Object[]
toRelationFields(OpenJPAStateManager sm, java.lang.Object data, FetchConfiguration fetch)
Transform the given data into relation field values.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.openjpa.kernel.PCData
getCache, getData, getId, getImplData, getType, getVersion, load, load, setImplData, setVersion, store, store
-
-
-
-
Method Detail
-
getLoaded
public abstract java.util.BitSet getLoaded()
Return the loaded field mask.
-
newEmbeddedPCData
public abstract AbstractPCData newEmbeddedPCData(OpenJPAStateManager sm)
Create a new pcdata for holding the state of an embedded instance.
-
isLoaded
public boolean isLoaded(int field)
Description copied from interface:PCData
Whether the given field index has stored data.
-
toField
protected java.lang.Object toField(OpenJPAStateManager sm, FieldMetaData fmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data value into its field value.
-
toNestedField
protected java.lang.Object toNestedField(OpenJPAStateManager sm, ValueMetaData vmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data value to its field value. The data value may be a key, value, or element of a map or collection.
-
toNestedFields
protected java.util.Collection toNestedFields(OpenJPAStateManager sm, ValueMetaData vmd, java.util.Collection data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data value to its field value. The data value may be a key, value, or element of a map or collection.
-
toRelationField
protected java.lang.Object toRelationField(OpenJPAStateManager sm, ValueMetaData vmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data into a relation field value. Default implementation assumes the data is an oid.
-
toRelationFields
protected java.lang.Object[] toRelationFields(OpenJPAStateManager sm, java.lang.Object data, FetchConfiguration fetch)
Transform the given data into relation field values. Default implementation assumes the data is an oid.
-
toEmbeddedField
protected java.lang.Object toEmbeddedField(OpenJPAStateManager sm, ValueMetaData vmd, java.lang.Object data, FetchConfiguration fetch, java.lang.Object context)
Transform the given data into an embedded PC field value. Default implementation assumes the data is anAbstractPCData
.
-
toData
protected java.lang.Object toData(FieldMetaData fmd, java.lang.Object val, StoreContext ctx)
Transform the given field value to a data value for caching. ReturnNULL
if unable to cache.
-
toNestedData
protected java.lang.Object toNestedData(ValueMetaData vmd, java.lang.Object val, StoreContext ctx)
Transform the given nested value to a cachable value. ReturnNULL
if the value cannot be cached.
-
toRelationData
protected java.lang.Object toRelationData(java.lang.Object val, StoreContext ctx)
Return the value to cache for the given object. Caches its oid by default.
-
toEmbeddedData
protected java.lang.Object toEmbeddedData(java.lang.Object val, StoreContext ctx)
Return the value to cache for the given embedded PC. Caches aPCData
fromnewEmbeddedPCData(org.apache.openjpa.kernel.OpenJPAStateManager)
by default.
-
-