org.apache.openjpa.meta
Class AbstractMetaDataDefaults

java.lang.Object
  extended by org.apache.openjpa.meta.AbstractMetaDataDefaults
All Implemented Interfaces:
CallbackModes, MetaDataDefaults

public abstract class AbstractMetaDataDefaults
extends java.lang.Object
implements MetaDataDefaults

Abstract metadata defaults.

Author:
Abe White

Field Summary
 
Fields inherited from interface org.apache.openjpa.event.CallbackModes
CALLBACK_FAIL_FAST, CALLBACK_IGNORE, CALLBACK_LOG, CALLBACK_RETHROW, CALLBACK_ROLLBACK
 
Constructor Summary
AbstractMetaDataDefaults()
           
 
Method Summary
protected  int getAccessType(ClassMetaData meta)
          Return the access type of the given metadata.
 java.lang.reflect.Member getBackingMember(FieldMetaData fmd)
          Return the backing member for the given field metadata.
 int getCallbackMode()
          What to do on lifecycle callback exceptions.
 boolean getCallbacksBeforeListeners(int type)
          If callbacks are fired before listeners for the given event type.
 int getDefaultAccessType()
          The default access type for base classes with ACCESS_UNKNOWN.
protected  java.lang.String getFieldName(java.lang.reflect.Member member)
          Return the field name for the given member.
 boolean getIgnoreNonPersistent()
           
 boolean getUsePCRegistry()
          Whether to attempt to use the information from registered classes to populate metadata defaults.
protected abstract  boolean isDefaultPersistent(ClassMetaData meta, java.lang.reflect.Member member, java.lang.String name)
          Return true if the given member is persistent by default.
protected  boolean isReservedFieldName(java.lang.String name)
          Returns true if the given field name is reserved for unmanaged fields.
protected static boolean isUserDefined(java.lang.Class cls)
          Helper method; returns true if the given class appears to be user-defined.
 void populate(ClassMetaData meta, int access)
          Populate the given metadata with default settings.
protected  void populate(FieldMetaData fmd)
          Populate initial field data.
 void setCallbackMode(int mode)
           
 void setCallbackMode(int mode, boolean on)
           
 void setDefaultAccessType(int access)
          The default access type for base classes with ACCESS_UNKNOWN.
 void setIgnoreNonPersistent(boolean ignore)
          Whether to ignore members which are not persistent by default during metadata population.
 void setUsePCRegistry(boolean pcRegistry)
          Whether to attempt to use the information from registered classes to populate metadata defaults.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMetaDataDefaults

public AbstractMetaDataDefaults()
Method Detail

getUsePCRegistry

public boolean getUsePCRegistry()
Whether to attempt to use the information from registered classes to populate metadata defaults. Defaults to true.


setUsePCRegistry

public void setUsePCRegistry(boolean pcRegistry)
Whether to attempt to use the information from registered classes to populate metadata defaults. Defaults to true.


setDefaultAccessType

public void setDefaultAccessType(int access)
The default access type for base classes with ACCESS_UNKNOWN. Returns ACCESS_FIELD by default.


getDefaultAccessType

public int getDefaultAccessType()
The default access type for base classes with ACCESS_UNKNOWN. Returns ACCESS_FIELD by default.

Specified by:
getDefaultAccessType in interface MetaDataDefaults

getCallbackMode

public int getCallbackMode()
Description copied from interface: MetaDataDefaults
What to do on lifecycle callback exceptions.

Specified by:
getCallbackMode in interface MetaDataDefaults

setCallbackMode

public void setCallbackMode(int mode)

setCallbackMode

public void setCallbackMode(int mode,
                            boolean on)

getCallbacksBeforeListeners

public boolean getCallbacksBeforeListeners(int type)
Description copied from interface: MetaDataDefaults
If callbacks are fired before listeners for the given event type. Defaults to false.

Specified by:
getCallbacksBeforeListeners in interface MetaDataDefaults

getIgnoreNonPersistent

public boolean getIgnoreNonPersistent()

setIgnoreNonPersistent

public void setIgnoreNonPersistent(boolean ignore)
Description copied from interface: MetaDataDefaults
Whether to ignore members which are not persistent by default during metadata population. Defaults to true.

Specified by:
setIgnoreNonPersistent in interface MetaDataDefaults

populate

public void populate(ClassMetaData meta,
                     int access)
Description copied from interface: MetaDataDefaults
Populate the given metadata with default settings.

Specified by:
populate in interface MetaDataDefaults
access - access type constant from ClassMetaData

populate

protected void populate(FieldMetaData fmd)
Populate initial field data. Does nothing by default.


getAccessType

protected int getAccessType(ClassMetaData meta)
Return the access type of the given metadata. May be a bitwise combination of field and property access constants, or ACCESS_UNKNOWN. Returns ACCESS_FIELD by default.


getFieldName

protected java.lang.String getFieldName(java.lang.reflect.Member member)
Return the field name for the given member. This will only be invoked on members of the right type (field vs. method). Return null if the member cannot be managed. Default behavior: For fields, returns the field name. For getter methods, returns the minus "get" or "is" with the next letter lower-cased. For other methods, returns null.


isReservedFieldName

protected boolean isReservedFieldName(java.lang.String name)
Returns true if the given field name is reserved for unmanaged fields.


isDefaultPersistent

protected abstract boolean isDefaultPersistent(ClassMetaData meta,
                                               java.lang.reflect.Member member,
                                               java.lang.String name)
Return true if the given member is persistent by default. This will only be invoked on members of the right type (field vs. method). Returns false if member is static or final by default.

Parameters:
name - the field name from getFieldName(java.lang.reflect.Member)

getBackingMember

public java.lang.reflect.Member getBackingMember(FieldMetaData fmd)
Description copied from interface: MetaDataDefaults
Return the backing member for the given field metadata.

Specified by:
getBackingMember in interface MetaDataDefaults

isUserDefined

protected static boolean isUserDefined(java.lang.Class cls)
Helper method; returns true if the given class appears to be user-defined.



Copyright © 2006 Apache Software Foundation. All Rights Reserved.