org.apache.openjpa.util
Class ImplHelper

java.lang.Object
  extended by org.apache.openjpa.util.ImplHelper

public class ImplHelper
extends Object

Helper for OpenJPA back-ends.

Since:
0.3.0
Author:
Abe White

Constructor Summary
ImplHelper()
           
 
Method Summary
static void close(Object o)
          Close the given resource.
static Object generateFieldValue(StoreContext ctx, FieldMetaData fmd)
          Generate a value for the given metadata, or return null.
static Object generateIdentityValue(StoreContext ctx, ClassMetaData meta, int typeCode)
          Generate a value for the given metadata, or return null.
static Method getGetter(Class cls, String prop)
          Return the getter method matching the given property name.
static Method getSetter(Class cls, String prop)
          Return the setter method matching the given property name.
static BitSet getUpdateFields(OpenJPAStateManager sm)
          Returns the fields of the state that require an update.
static boolean isManageable(Object instance)
          Returns true if the specified instance is manageable.
static boolean isManagedType(Class type)
          Returns true if the specified class is a type that can be managed by OpenJPA.
static Collection loadAll(Collection sms, StoreManager store, PCState state, int load, FetchConfiguration fetch, Object context)
          Helper for store manager implementations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImplHelper

public ImplHelper()
Method Detail

getGetter

public static Method getGetter(Class cls,
                               String prop)
Return the getter method matching the given property name.


getSetter

public static Method getSetter(Class cls,
                               String prop)
Return the setter method matching the given property name.


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.

Since:
0.4.0
See Also:
StoreManager.loadAll(java.util.Collection, org.apache.openjpa.kernel.PCState, int, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)

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(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.

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


Copyright © 2006 Apache Software Foundation. All Rights Reserved.