|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.sco.SCOUtils
Collection of utilities for second class objects.
Constructor Summary | |
SCOUtils()
|
Method Summary | |
static boolean |
arrayIsStoredInSingleColumn(AbstractPropertyMetaData fmd)
Convenience method to return if an array field has the elements stored into the table of the field as a single (BLOB) column. |
static boolean |
collectionHasElementsWithoutIdentity(AbstractPropertyMetaData fmd)
Convenience method to return if a collection field has elements without their own identity. |
static boolean |
collectionHasSerialisedElements(AbstractPropertyMetaData fmd)
Convenience method to return if a collection field has the elements serialised into the table of the field as a single BLOB. |
static boolean |
mapHasKeysWithoutIdentity(AbstractPropertyMetaData fmd)
Convenience method to return if a map field has keys without their own identity. |
static boolean |
mapHasSerialisedKeysAndValues(AbstractPropertyMetaData fmd)
Convenience method to return if a map field has the keys/values serialised into the table of the field as a single BLOB. |
static boolean |
mapHasValuesWithoutIdentity(AbstractPropertyMetaData fmd)
Convenience method to return if a map field has values without their own identity. |
static SCO |
newSCOInstance(java.lang.Class declaredType,
java.lang.Object ownerSM,
AbstractPropertyMetaData fmd,
java.lang.Object value,
boolean forUpdate)
Method to create a new SCO wrapper for a SCO type. |
static void |
populateMapDelegateWithStoreData(java.util.Map delegate,
MapStore store,
StateManager ownerSM)
Convenience method to populate the passed delegate Map with the keys/values from the associated Store. |
static java.lang.Object[] |
toArray(CollectionStore backingStore,
StateManager sm)
Returns true if this collection contains the specified element. |
static java.lang.Object[] |
toArray(CollectionStore backingStore,
StateManager sm,
java.lang.Object[] a)
Returns an array containing all of the elements in this collection; |
static void |
updateCollectionWithCollection(java.util.Collection coll,
java.util.Collection newColl)
Convenience method to update a collection to contain the elements in another collection. |
static void |
updateStoreWithCollection(CollectionStore store,
StateManager ownerSM,
java.util.Collection newColl)
Convenience method to update a Store collection to contain the elements in another collection. |
static boolean |
useCachedLazyLoading(StateManager ownerSM,
java.lang.String fieldName,
AbstractClassMetaData cmd)
Accessor for whether the use lazy loading when caching the collection. |
static boolean |
useContainerCache(StateManager ownerSM,
java.lang.String fieldName,
AbstractClassMetaData cmd)
Utility to return whether or not to use the container cache for the collection/map for the passed StateManager SCO. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SCOUtils()
Method Detail |
public static SCO newSCOInstance(java.lang.Class declaredType, java.lang.Object ownerSM, AbstractPropertyMetaData fmd, java.lang.Object value, boolean forUpdate)
declaredType
- The class of the objectownerSM
- State Manager for the owning objectfmd
- The Field MetaData for the related field.value
- The value we are wrappingforUpdate
- Whether the SCO needs updating in the datastore with this value
public static boolean useContainerCache(StateManager ownerSM, java.lang.String fieldName, AbstractClassMetaData cmd)
ownerSM
- The StateManager for the SCO fieldfieldName
- Name of the field.cmd
- MetaData for class
public static boolean useCachedLazyLoading(StateManager ownerSM, java.lang.String fieldName, AbstractClassMetaData cmd)
ownerSM
- StateManager of the owning objectfieldName
- Name of the collection/map fieldcmd
- MetaData for the class
public static boolean collectionHasElementsWithoutIdentity(AbstractPropertyMetaData fmd)
fmd
- MetaData for the field
public static boolean mapHasKeysWithoutIdentity(AbstractPropertyMetaData fmd)
fmd
- MetaData for the field
public static boolean mapHasValuesWithoutIdentity(AbstractPropertyMetaData fmd)
fmd
- MetaData for the field
public static boolean collectionHasSerialisedElements(AbstractPropertyMetaData fmd)
fmd
- MetaData for the field
public static boolean arrayIsStoredInSingleColumn(AbstractPropertyMetaData fmd)
fmd
- MetaData for the field
public static boolean mapHasSerialisedKeysAndValues(AbstractPropertyMetaData fmd)
fmd
- MetaData for the field
public static void updateCollectionWithCollection(java.util.Collection coll, java.util.Collection newColl)
coll
- The collection to updatenewColl
- The new collection whose elements we need in "coll"public static void updateStoreWithCollection(CollectionStore store, StateManager ownerSM, java.util.Collection newColl)
store
- The store to apply changes toownerSM
- StateManager of the ownernewColl
- The new collection whose elements we need in "coll"public static void populateMapDelegateWithStoreData(java.util.Map delegate, MapStore store, StateManager ownerSM)
The issue here is that we need to load the keys and values in as few calls as possible. The method employed here reads in the keys (if PersistenceCapable), then the values (if PersistenceCapable), and then the "entries" (ids of keys and values) so we can associate the keys to the values.
delegate
- The delegatestore
- The StoreownerSM
- State Manager of the owner of the map.public static java.lang.Object[] toArray(CollectionStore backingStore, StateManager sm)
This implementation iterates over the elements in the collection, checking each element in turn for equality with the specified element.
backingStore
- the Storesm
- the StateManager
public static java.lang.Object[] toArray(CollectionStore backingStore, StateManager sm, java.lang.Object[] a)
backingStore
- the Storesm
- the StateManagera
- the array into which the elements of the collection are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose.
java.lang.NullPointerException
- if the specified array is null.
java.lang.ArrayStoreException
- if the runtime type of the specified array
is not a supertype of the runtime type of every element in this
collection.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |