Package org.apache.openjpa.persistence
Class AnnotationPersistenceMetaDataParser
java.lang.Object
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser
- All Implemented Interfaces:
MetaDataModes
- Direct Known Subclasses:
AnnotationPersistenceMappingParser
Persistence annotation metadata parser. Currently does not parse
deployment descriptors.
- Author:
- Abe White, Steve Kim
-
Field Summary
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
-
Constructor Summary
ConstructorDescriptionConstructor; supply configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addHints
(QueryMetaData meta, jakarta.persistence.QueryHint... hints) protected void
addSourceInfo
(AnnotatedElement el, QueryMetaData meta) void
clear()
Clear caches.Configuration supplied on construction.Return the environmental class loader to pass on to parsed metadata instances.getLog()
Metadata log.boolean
Whether to allow later parses of mapping information to override earlier information for the same class.int
getMode()
The parse mode.Returns the repository for this parser.protected File
Determine the source file we're parsing.protected boolean
handleUnknownClassAnnotation
(ClassMetaData meta, Annotation anno) Allow subclasses to handle unknown annotations.protected boolean
handleUnknownMemberAnnotation
(FieldMetaData fmd, Annotation anno) Allow subclasses to handle unknown annotations.protected boolean
handleUnknownPackageAnnotation
(Package pkg, Annotation anno) Allow subclasses to handle unknown annotations.protected boolean
Convenience method for interpretinggetMode()
.protected boolean
Returns true if we're in mapping mode or in metadata mode with mapping overide enabled.protected boolean
Convenience method for interpretinggetMode()
.protected boolean
Convenience method for interpretinggetMode()
.protected String
normalizeCatalogName
(String catName) protected String
normalizeSchemaName
(String schName) protected String
normalizeSequenceName
(String seqName) void
Parse persistence metadata for the given class.static Collection<LifecycleCallbacks>[]
parseCallbackMethods
(Class<?> cls, Collection<LifecycleCallbacks>[] callbacks, boolean sups, boolean listener, MetaDataRepository repos) Parse callback methods into the given array, and return that array, creating one if null.protected void
Parse class mapping annotations.protected void
Setup the field as a LOB mapping.protected void
Parse member mapping components.protected void
Parse package mapping annotations.void
setEnvClassLoader
(ClassLoader loader) Set the environmental class loader to pass on to parsed metadata instances.void
setMappingOverride
(boolean override) Whether to allow later parses of mapping information to override earlier information for the same class.void
setMode
(int mode) The parse mode.void
setMode
(int mode, boolean on) The parse mode.void
setRepository
(MetaDataRepository repos) Set the metadata repository for this parser.protected MultiQueryMetaData.Parameter.Mode
toKernelParameterMode
(jakarta.persistence.ParameterMode mode) static Class<?>
toOverrideType
(Class<?> cls) Convert the given class to its OpenJPA type override equivalent.
-
Field Details
-
_cls
-
_stack
-
-
Constructor Details
-
AnnotationPersistenceMetaDataParser
Constructor; supply configuration.
-
-
Method Details
-
getConfiguration
Configuration supplied on construction. -
getLog
Metadata log. -
getRepository
Returns the repository for this parser. If none has been set, create a new repository and sets it. -
setRepository
Set the metadata repository for this parser. -
getEnvClassLoader
Return the environmental class loader to pass on to parsed metadata instances. -
setEnvClassLoader
Set the environmental class loader to pass on to parsed metadata instances. -
getMappingOverride
public boolean getMappingOverride()Whether to allow later parses of mapping information to override earlier information for the same class. Defaults to false. Useful when a tool is mapping a class, so that annotation partial mapping information can be used even when mappings are stored in another location. -
setMappingOverride
public void setMappingOverride(boolean override) Whether to allow later parses of mapping information to override earlier information for the same class. Defaults to false. Useful when a tool is mapping a class, so that annotation partial mapping information can be used even when mappings are stored in another location. -
getMode
public int getMode()The parse mode. -
setMode
public void setMode(int mode, boolean on) The parse mode. -
setMode
public void setMode(int mode) The parse mode. -
isMetaDataMode
protected boolean isMetaDataMode()Convenience method for interpretinggetMode()
. -
isQueryMode
protected boolean isQueryMode()Convenience method for interpretinggetMode()
. -
isMappingMode
protected boolean isMappingMode()Convenience method for interpretinggetMode()
. -
isMappingOverrideMode
protected boolean isMappingOverrideMode()Returns true if we're in mapping mode or in metadata mode with mapping overide enabled. -
clear
public void clear()Clear caches. -
parse
Parse persistence metadata for the given class. -
parsePackageMappingAnnotations
Parse package mapping annotations. -
handleUnknownPackageAnnotation
Allow subclasses to handle unknown annotations. -
parseClassMappingAnnotations
Parse class mapping annotations. -
handleUnknownClassAnnotation
Allow subclasses to handle unknown annotations. -
getSourceFile
Determine the source file we're parsing. -
parseCallbackMethods
public static Collection<LifecycleCallbacks>[] parseCallbackMethods(Class<?> cls, Collection<LifecycleCallbacks>[] callbacks, boolean sups, boolean listener, MetaDataRepository repos) Parse callback methods into the given array, and return that array, creating one if null. Each index into the array is a collection of callback adapters for that numeric event type.- Parameters:
sups
- whether to scan superclasseslistener
- whether this is a listener or not
-
parseMemberMappingAnnotations
Parse member mapping components. -
handleUnknownMemberAnnotation
Allow subclasses to handle unknown annotations. -
toOverrideType
Convert the given class to its OpenJPA type override equivalent. -
parseLobMapping
Setup the field as a LOB mapping. -
normalizeSequenceName
-
normalizeSchemaName
-
normalizeCatalogName
-
toKernelParameterMode
protected MultiQueryMetaData.Parameter.Mode toKernelParameterMode(jakarta.persistence.ParameterMode mode) -
addSourceInfo
-
addHints
-