|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.meta.AbstractMetaDataDefaults
public abstract class AbstractMetaDataDefaults
Abstract implementation provides a set of generic utilities for detecting persistence meta-data of Field/Member. Also provides bean-style properties such as access style or identity type to be used by default when such information is not derivable from available meta-data.
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 | |
---|---|
Member |
getBackingMember(FieldMetaData fmd)
Gets the backing member of the given field. |
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. |
int |
getDefaultIdentityType()
The default identity type for unmapped classes without primary key fields. |
protected List<String> |
getFieldAccessNames(ClassMetaData meta)
Return the list of fields in meta that use field access,
or null if a list of fields is unobtainable. |
static String |
getFieldName(Member member)
Return the field name for the given member. |
boolean |
getIgnoreNonPersistent()
|
protected abstract List<Member> |
getPersistentMembers(ClassMetaData meta,
boolean ignoreTransient)
|
protected List<String> |
getPropertyAccessNames(ClassMetaData meta)
Return the list of methods in meta that use property access,
or null if a list of methods is unobtainable. |
Class<?> |
getUnimplementedExceptionType()
Return a runtime exception class to throw for un-implemented managed interface methods. |
boolean |
getUsePCRegistry()
Whether to attempt to use the information from registered classes to populate metadata defaults. |
static boolean |
isBoolean(Class<?> cls)
|
static boolean |
isBooleanGetter(Method method)
Affirms if the given method matches the following signature public boolean isXXX()
public Boolean isXXX() |
boolean |
isDataStoreObjectIdFieldUnwrapped()
Whether the field in the object id class corresponding to a datastore id persistence-capable primary key field is the simple datastore id value of the related instance. |
boolean |
isDeclaredInterfacePersistent()
Whether declared interfaces of a class are treated as persistent types. |
protected abstract boolean |
isDefaultPersistent(ClassMetaData meta,
Member member,
String name,
boolean ignoreTransient)
Return true if the given member is persistent by default. |
static boolean |
isGetter(Method method,
boolean includePrivate)
Affirms if the given method signature matches bean-style getter method signature. public T getXXX() where T is any non-void type.or public T isXXX() where T is boolean or Boolean. |
static boolean |
isNormalGetter(Method method)
Affirms if the given method matches the following signature public T getXXX()
where T is any non-void type. |
protected boolean |
isReservedFieldName(String name)
Returns true if the given field name is reserved for unmanaged fields. |
protected static boolean |
isUserDefined(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. |
void |
populate(ClassMetaData meta,
int access,
boolean ignoreTransient)
Populate the given metadata with default settings. |
protected void |
populate(FieldMetaData fmd)
|
void |
setCallbackMode(int mode)
|
void |
setCallbackMode(int mode,
boolean on)
|
void |
setDataStoreObjectIdFieldUnwrapped(boolean unwrapped)
|
void |
setDeclaredInterfacePersistent(boolean pers)
|
void |
setDefaultAccessType(int access)
The default access type for base classes with ACCESS_UNKNOWN. |
void |
setDefaultIdentityType(int identity)
The default identity type for unmapped classes without primary key fields. |
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. |
static boolean |
startsWith(String full,
String head)
Affirms if the given full string starts with the given head. |
static List<String> |
toNames(List<? extends Member> members)
|
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.meta.MetaDataDefaults |
---|
getMemberByProperty, isAbstractMappingUniDirectional, isNonDefaultMappingAllowed |
Constructor Detail |
---|
public AbstractMetaDataDefaults()
Method Detail |
---|
public boolean getUsePCRegistry()
public void setUsePCRegistry(boolean pcRegistry)
public int getDefaultAccessType()
getDefaultAccessType
in interface MetaDataDefaults
public void setDefaultAccessType(int access)
public int getDefaultIdentityType()
getDefaultIdentityType
in interface MetaDataDefaults
public void setDefaultIdentityType(int identity)
public int getCallbackMode()
MetaDataDefaults
getCallbackMode
in interface MetaDataDefaults
public void setCallbackMode(int mode)
public void setCallbackMode(int mode, boolean on)
public boolean getCallbacksBeforeListeners(int type)
MetaDataDefaults
getCallbacksBeforeListeners
in interface MetaDataDefaults
public boolean isDeclaredInterfacePersistent()
MetaDataDefaults
isDeclaredInterfacePersistent
in interface MetaDataDefaults
public void setDeclaredInterfacePersistent(boolean pers)
public boolean isDataStoreObjectIdFieldUnwrapped()
MetaDataDefaults
isDataStoreObjectIdFieldUnwrapped
in interface MetaDataDefaults
public void setDataStoreObjectIdFieldUnwrapped(boolean unwrapped)
public boolean getIgnoreNonPersistent()
public void setIgnoreNonPersistent(boolean ignore)
MetaDataDefaults
setIgnoreNonPersistent
in interface MetaDataDefaults
public void populate(ClassMetaData meta, int access)
MetaDataDefaults
populate
in interface MetaDataDefaults
access
- access type constant from ClassMetaData
public void populate(ClassMetaData meta, int access, boolean ignoreTransient)
MetaDataDefaults
populate
in interface MetaDataDefaults
access
- access type constant from ClassMetaData
protected abstract List<Member> getPersistentMembers(ClassMetaData meta, boolean ignoreTransient)
protected void populate(FieldMetaData fmd)
protected List<String> getFieldAccessNames(ClassMetaData meta)
meta
that use field access,
or null
if a list of fields is unobtainable. An empty list
should be returned if the list of fields is obtainable, but there
happens to be no field access in meta
.
This is used for error reporting purposes only, so need not be efficient.
This implementation returns null
.
protected List<String> getPropertyAccessNames(ClassMetaData meta)
meta
that use property access,
or null
if a list of methods is unobtainable. An empty list
should be returned if the list of methods is obtainable, but there
happens to be no property access in meta
.
This is used for error reporting purposes only, so need not be efficient.
This implementation returns null
.
public static String getFieldName(Member member)
protected boolean isReservedFieldName(String name)
protected abstract boolean isDefaultPersistent(ClassMetaData meta, Member member, String name, boolean ignoreTransient)
name
- the field name from getFieldName(java.lang.reflect.Member)
public Member getBackingMember(FieldMetaData fmd)
getBackingMember
in interface MetaDataDefaults
public Class<?> getUnimplementedExceptionType()
MetaDataDefaults
getUnimplementedExceptionType
in interface MetaDataDefaults
protected static boolean isUserDefined(Class<?> cls)
public static boolean isNormalGetter(Method method)
public T getXXX()
where T is any non-void type.
public static boolean isBooleanGetter(Method method)
public boolean isXXX()
public Boolean isXXX()
public static boolean isGetter(Method method, boolean includePrivate)
public T getXXX()
where T is any non-void type. public T isXXX()
where T is boolean or Boolean.
public static boolean startsWith(String full, String head)
public static boolean isBoolean(Class<?> cls)
public static List<String> toNames(List<? extends Member> members)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |