Package org.apache.openjpa.persistence
Class PersistenceMetaDataDefaults
java.lang.Object
org.apache.openjpa.meta.AbstractMetaDataDefaults
org.apache.openjpa.persistence.PersistenceMetaDataDefaults
- All Implemented Interfaces:
CallbackModes,MetaDataDefaults
JPA-based metadata defaults.
- Author:
- Patrick Linskey, Abe White, Pinaki Poddar
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AnnotatedFilterprotected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AccessFilterprotected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.MemberFilterprotected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.GetterFilterprotected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.MemberFilterprotected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.TransientFilterprotected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AccessFilterSet of Inclusion Filters based on member type, access type or transient annotations.protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.SetterFilterFields inherited from interface org.apache.openjpa.event.CallbackModes
CALLBACK_FAIL_FAST, CALLBACK_IGNORE, CALLBACK_LOG, CALLBACK_RETHROW, CALLBACK_ROLLBACK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the default schema.Return the list of fields inmetathat use field access, ornullif a list of fields is unobtainable.getMemberByProperty(ClassMetaData meta, String property, int access, boolean applyDefaultRule) Gets either the instance field or the getter method depending upon the access style of the given meta-data.static PersistenceStrategygetPersistenceStrategy(FieldMetaData fmd, Member member) Return the code for the strategy of the given member.static PersistenceStrategygetPersistenceStrategy(FieldMetaData fmd, Member member, boolean ignoreTransient) Return the code for the strategy of the given member.getPersistentMembers(ClassMetaData meta, boolean ignoreTransient) Gets the members that are backing members for attributes being persisted.Return the list of methods inmetathat use property access, ornullif a list of methods is unobtainable.booleanWhether the relationship in MappedSuper class must be uni-directional.Whether cascade-persist was declared in the persistence unit defaults.protected booleanisDefaultPersistent(ClassMetaData meta, Member member, String name) protected booleanisDefaultPersistent(ClassMetaData meta, Member member, String name, boolean ignoreTransient) Return true if the given member is persistent by default.booleanWhether non-default mapping is allowed.voidpopulate(ClassMetaData meta, int access) Populates the given class metadata.voidpopulate(ClassMetaData meta, int access, boolean ignoreTransient) Populates the given class metadata.protected voidpopulate(FieldMetaData fmd) voidvoidsetDefaultAccessType(String type) Auto-configuration method for the default access type of base classes with ACCESS_UNKNOWNvoidvoidsetDefaultSchema(String schema) Sets the default schema.voidMethods inherited from class org.apache.openjpa.meta.AbstractMetaDataDefaults
getBackingMember, getCallbackMode, getCallbacksBeforeListeners, getDefaultAccessType, getDefaultIdentityType, getFieldName, getIgnoreNonPersistent, getUnimplementedExceptionType, getUsePCRegistry, isBoolean, isBooleanGetter, isDataStoreObjectIdFieldUnwrapped, isDeclaredInterfacePersistent, isGetter, isNormalGetter, isReservedFieldName, isUserDefined, setCallbackMode, setCallbackMode, setDataStoreObjectIdFieldUnwrapped, setDeclaredInterfacePersistent, setDefaultAccessType, setDefaultIdentityType, setIgnoreNonPersistent, setUsePCRegistry, startsWith, toNames
-
Field Details
-
propertyAccessFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AccessFilter propertyAccessFilterSet of Inclusion Filters based on member type, access type or transient annotations. Used to determine the persistent field/methods. -
fieldAccessFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AccessFilter fieldAccessFilter -
fieldFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.MemberFilter fieldFilter -
methodFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.MemberFilter methodFilter -
nonTransientFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.TransientFilter nonTransientFilter -
annotatedFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.AnnotatedFilter annotatedFilter -
getterFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.GetterFilter getterFilter -
setterFilter
protected org.apache.openjpa.persistence.PersistenceMetaDataDefaults.SetterFilter setterFilter
-
-
Constructor Details
-
PersistenceMetaDataDefaults
public PersistenceMetaDataDefaults()
-
-
Method Details
-
getPersistenceStrategy
Return the code for the strategy of the given member. Return null if no strategy. -
getPersistenceStrategy
public static PersistenceStrategy getPersistenceStrategy(FieldMetaData fmd, Member member, boolean ignoreTransient) Return the code for the strategy of the given member. Return null if no strategy. -
setDefaultAccessType
Auto-configuration method for the default access type of base classes with ACCESS_UNKNOWN -
populate
Populates the given class metadata. The access style determines which field and/or getter method will contribute as the persistent property of the given class. If the given access is unknown, then the access type is to be determined at first.- Specified by:
populatein interfaceMetaDataDefaults- Overrides:
populatein classAbstractMetaDataDefaultsaccess- access type constant fromClassMetaData- See Also:
-
determineAccessType(ClassMetaData)
-
populate
Populates the given class metadata. The access style determines which field and/or getter method will contribute as the persistent property of the given class. If the given access is unknown, then the access type is to be determined at first.- Specified by:
populatein interfaceMetaDataDefaults- Overrides:
populatein classAbstractMetaDataDefaultsaccess- access type constant fromClassMetaData- See Also:
-
determineAccessType(ClassMetaData)
-
populate
- Overrides:
populatein classAbstractMetaDataDefaults
-
getPersistentMembers
Gets the members that are backing members for attributes being persisted. Unlike #getPersistentFields(ClassMetaData) and #getPersistentMethods(ClassMetaData) which returns possible candidates, the result of this method is definite. Side-effect of this method is if the given class metadata has no access type set, this method will set it.- Specified by:
getPersistentMembersin classAbstractMetaDataDefaults
-
getFieldAccessNames
Description copied from class:AbstractMetaDataDefaultsReturn the list of fields inmetathat use field access, ornullif 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 inmeta. This is used for error reporting purposes only, so need not be efficient. This implementation returnsnull.- Overrides:
getFieldAccessNamesin classAbstractMetaDataDefaults
-
getPropertyAccessNames
Description copied from class:AbstractMetaDataDefaultsReturn the list of methods inmetathat use property access, ornullif 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 inmeta. This is used for error reporting purposes only, so need not be efficient. This implementation returnsnull.- Overrides:
getPropertyAccessNamesin classAbstractMetaDataDefaults
-
isDefaultPersistent
-
isDefaultPersistent
protected boolean isDefaultPersistent(ClassMetaData meta, Member member, String name, boolean ignoreTransient) Description copied from class:AbstractMetaDataDefaultsReturn 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.- Specified by:
isDefaultPersistentin classAbstractMetaDataDefaultsname- the field name fromAbstractMetaDataDefaults.getFieldName(java.lang.reflect.Member)
-
getMemberByProperty
public Member getMemberByProperty(ClassMetaData meta, String property, int access, boolean applyDefaultRule) Gets either the instance field or the getter method depending upon the access style of the given meta-data.- Parameters:
meta- is the declaring classproperty- name of the logical attributeaccess- whether to look for the field of getter method. If unknown, then field or property is chosen based on the access type used by the given class.applyDefaultRule- if true and access is unknown then scans the annotation on the member to determine access.
-
isAbstractMappingUniDirectional
Description copied from interface:MetaDataDefaultsWhether the relationship in MappedSuper class must be uni-directional. -
setAbstractMappingUniDirectional
-
isNonDefaultMappingAllowed
Description copied from interface:MetaDataDefaultsWhether non-default mapping is allowed. -
setNonDefaultMappingAllowed
-
isDefaultCascadePersistEnabled
Description copied from interface:MetaDataDefaultsWhether cascade-persist was declared in the persistence unit defaults. -
setDefaultCascadePersistEnabled
-
getDefaultSchema
Description copied from interface:MetaDataDefaultsReturns the default schema. -
setDefaultSchema
Description copied from interface:MetaDataDefaultsSets the default schema.
-