Package org.apache.openjpa.util
Class ImplHelper
- java.lang.Object
-
- org.apache.openjpa.util.ImplHelper
-
public class ImplHelper extends Object
Helper for OpenJPA back-ends.- Since:
- 0.3.0
- Author:
- Abe White
-
-
Field Summary
Fields Modifier and Type Field Description static Map_unenhancedInstanceMap
-
Constructor Summary
Constructors Constructor Description ImplHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(Object o)Close the given resource.static ObjectgenerateFieldValue(StoreContext ctx, FieldMetaData fmd)Generate a value for the given metadata, or return null.static ObjectgenerateIdentityValue(StoreContext ctx, ClassMetaData meta, int typeCode)Generate a value for the given metadata, or return null.static ObjectgetManagedInstance(Object o)static BitSetgetUpdateFields(OpenJPAStateManager sm)Returns the fields of the state that require an update.static booleanisAssignable(Class from, Class to)Returns true if the referenced "to" class is assignable to the "from" class.static booleanisManageable(Object instance)Returns true if the specified instance is manageable.static booleanisManagedType(OpenJPAConfiguration conf, Class type)Returns true if the specified class is a type that can be managed by OpenJPA.static CollectionloadAll(Collection sms, StoreManager store, PCState state, int load, FetchConfiguration fetch, Object context)Helper for store manager implementations.static voidregisterPersistenceCapable(ReflectingPersistenceCapable pc)static PersistenceCapabletoPersistenceCapable(Object o, Object ctx)
-
-
-
Field Detail
-
_unenhancedInstanceMap
public static final Map _unenhancedInstanceMap
-
-
Method Detail
-
loadAll
public static Collection loadAll(Collection sms, StoreManager store, PCState state, int load, FetchConfiguration fetch, Object context)
Helper for store manager implementations. This method simply delegates to the proper singular method for each state manager.
-
generateIdentityValue
public static Object generateIdentityValue(StoreContext ctx, ClassMetaData meta, int typeCode)
Generate a value for the given metadata, or return null. Generates values for hte following strategies:ValueStrategies.SEQUENCE,ValueStrategies.UUID_STRING,ValueStrategies.UUID_HEX
-
generateFieldValue
public static Object generateFieldValue(StoreContext ctx, FieldMetaData fmd)
Generate a value for the given metadata, or return null. Generates values for hte following strategies:ValueStrategies.SEQUENCE,ValueStrategies.UUID_STRING,ValueStrategies.UUID_HEX
-
getUpdateFields
public static BitSet getUpdateFields(OpenJPAStateManager sm)
Returns the fields of the state that require an update.- Parameters:
sm- the state to check- Returns:
- the BitSet of fields that need update, or null if none
-
close
public static void close(Object o)
Close the given resource. The resource can be an extent iterator, query result, large result set relation, or any closeable OpenJPA component.
-
isManagedType
public static boolean isManagedType(OpenJPAConfiguration conf, Class type)
Returns true if the specified class is a type that can be managed by OpenJPA.- Parameters:
type- the class to test- Returns:
- true if the class is manageable.
- Since:
- 1.0.0
-
isManageable
public static boolean isManageable(Object instance)
Returns true if the specified instance is manageable.- Parameters:
instance- the object to check- Returns:
- true if the instance is a persistent type, false otherwise
-
isAssignable
public static boolean isAssignable(Class from, Class to)
Returns true if the referenced "to" class is assignable to the "from" class. This helper method utilizes a cache to help avoid the overhead of the Class.isAssignableFrom() method.- Parameters:
from- target class instance to be checked for assignabilityto- second class instance to be checked for assignability- Returns:
- true if the "to" class is assignable to the "from" class
-
toPersistenceCapable
public static PersistenceCapable toPersistenceCapable(Object o, Object ctx)
- Returns:
- the persistence-capable instance responsible for managing
o, ornullifois not manageable. - Since:
- 1.0.0
-
registerPersistenceCapable
public static void registerPersistenceCapable(ReflectingPersistenceCapable pc)
-
-