Module org.eclipse.persistence.moxy
Class AnnotationsProcessor
java.lang.Object
org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor
INTERNAL:
Purpose:To perform some initial processing of Java classes and JAXB 2.0 Annotations and generate meta data that can be used by the Mappings Generator and Schema Generator
Responsibilities:
- Generate a map of TypeInfo objects, keyed on class name
- Generate a map of user defined schema types
- Identify any class-based JAXB 2.0 callback methods, and create MarshalCallback and UnmarshalCallback objects to wrap them.
- Centralize processing which is common to both Schema Generation and Mapping Generation tasks
This class does the initial processing of the JAXB 2.0 Generation. It generates meta data that can be used by the later Schema Generation and Mapping Generation steps.
- Since:
- Oracle TopLink 11.1.1.0.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEnumTypeInfo
(JavaClass javaClass, EnumTypeInfo info) void
addPackageToNamespaceMapping
(String packageName, NamespaceInfo nsInfo) Add a package name/NamespaceInfo entry to the map.void
addPackageToPackageInfoMapping
(String packageName, PackageInfo packageInfo) void
addPackageToXmlElementNillable
(String packageName, XmlElementNillable xmlElementNillable) Add a package name/XmlElementNillable entry to the map.void
addPackageToXmlNullPolicy
(String packageName, XmlNullPolicy xmlNullPolicy) Add a package name/XmlNullPolicy entry to the map.void
addXmlRegistry
(String factoryClassName, XmlRegistry xmlReg) Add an XmlRegistry to ObjectFactory class name pair to the map.protected boolean
Compares a JavaModel JavaClass to a Class.protected boolean
Compares a JavaModel JavaClass to a Class.void
buildNewTypeInfo
(JavaClass[] javaClasses) Convenience method which class pre and postBuildTypeInfo for a given set of JavaClasses.void
void
Perform any final generation and/or validation operations on TypeInfo properties.findInfoForNamespace
(String namespace) getFieldPropertiesForClass
(JavaClass cls, TypeInfo info, boolean onlyPublic) getFieldPropertiesForClass
(JavaClass cls, TypeInfo info, boolean onlyPublic, boolean onlyExplicit) Lazy load and return the map of global elements.getNoAccessTypePropertiesForClass
(JavaClass cls, TypeInfo info) getPackageInfoForPackage
(JavaClass javaClass) getPackageInfoForPackage
(JavaPackage pack, String packageName) getPropertiesForClass
(JavaClass cls, TypeInfo info) getPropertyPropertiesForClass
(JavaClass cls, TypeInfo info, boolean onlyPublic) getPropertyPropertiesForClass
(JavaClass cls, TypeInfo info, boolean onlyPublic, boolean onlyExplicit) getPublicMemberPropertiesForClass
(JavaClass cls, TypeInfo info) getQNameForProperty
(Property property, String defaultName, JavaHasAnnotations element, NamespaceInfo namespaceInfo, TypeInfo info) getSchemaTypeFor
(JavaClass javaClass) getSchemaTypeOrNullFor
(JavaClass javaClass) getTypeInfosForPackage
(String packageName) Convenience method for returning all of the TypeInfo objects for a given package name.Map
<TypeMappingInfo, Class<?>> Map
<TypeMappingInfo, Class<?>> boolean
boolean
boolean
boolean
isMtomAttachment
(Property property) Indicates if a given Property represents an MTOM attachment.boolean
Indicates whether this AnnotationsProcessor has been configured to enable processing of XmlAccessorFactory annotations.postBuildTypeInfo
(JavaClass[] javaClasses) Process any additional classes (i.e.preBuildTypeInfo
(JavaClass[] javaClasses) Process class level annotations only.processNamespaceInformation
(XmlSchema xmlSchema) processObjectFactory
(JavaClass objectFactoryClass, List<JavaClass> classes) void
processPropertiesSuperClass
(JavaClass cls, TypeInfo info) void
void
processSchemaType
(String name, String namespace, String jClassQualifiedName) Use name, namespace and type information to setup a user-defined schema type.void
setDefaultNamespaceAllowed
(boolean isDefaultNamespaceAllowed) void
setHasSwaRef
(boolean swaRef) void
setHasXmlBindings
(boolean b) void
setPackageToNamespaceMappings
(HashMap<String, NamespaceInfo> packageToNamespaceMappings) Set namespace override info from XML bindings file.void
setPackageToPackageInfoMappings
(HashMap<String, PackageInfo> packageToPackageInfoMappings) void
setXmlAccessorFactorySupport
(boolean value) Sets whether this AnnotationsProcessor should process XmlAccessorFactory annotations.boolean
shouldGenerateTypeInfo
(JavaClass javaClass) void
updateGlobalElements
(JavaClass[] classesToProcess)
-
Constructor Details
-
AnnotationsProcessor
-
-
Method Details
-
createElementsForTypeMappingInfo
public void createElementsForTypeMappingInfo() -
preBuildTypeInfo
Process class level annotations only. It is assumed that a call to init() has been made prior to calling this method. After the types created via this method have been modified (if necessary) postBuildTypeInfo and processJavaClasses should be called to finish processing. -
postBuildTypeInfo
Process any additional classes (i.e. inner classes, @XmlSeeAlso, @XmlRegistry, etc.) for a given set of JavaClasses, then complete building all of the required TypeInfo objects. This method is typically called after init and preBuildTypeInfo have been called.- Returns:
- updated array of JavaClasses, made up of the original classes plus any additional ones
-
processPropertiesSuperClass
-
finalizeProperties
public void finalizeProperties()Perform any final generation and/or validation operations on TypeInfo properties. -
shouldGenerateTypeInfo
-
getPropertiesForClass
-
getFieldPropertiesForClass
-
getFieldPropertiesForClass
-
areEquals
Compares a JavaModel JavaClass to a Class. Equality is based on the raw name of the JavaClass compared to the canonical name of the Class. -
areEquals
Compares a JavaModel JavaClass to a Class. Equality is based on the raw name of the JavaClass compared to the canonical name of the Class. -
getPropertyPropertiesForClass
-
getPropertyPropertiesForClass
-
getPublicMemberPropertiesForClass
-
getPropertyMapFromArrayList
-
getNoAccessTypePropertiesForClass
-
processSchemaType
Use name, namespace and type information to setup a user-defined schema type. This method will typically be called when processing an @XmlSchemaType(s) annotation or xml-schema-type(s) metadata. -
processSchemaType
-
addEnumTypeInfo
-
getSchemaTypeOrNullFor
-
getSchemaTypeFor
-
processNamespaceInformation
-
getTypeInfos
-
getTypeInfoClasses
-
getUserDefinedSchemaTypes
-
getQNameForProperty
public QName getQNameForProperty(Property property, String defaultName, JavaHasAnnotations element, NamespaceInfo namespaceInfo, TypeInfo info) -
getPackageToPackageInfoMappings
-
addPackageToNamespaceMapping
Add a package name/NamespaceInfo entry to the map. This method will lazy-load the map if necessary. -
addPackageToXmlElementNillable
public void addPackageToXmlElementNillable(String packageName, XmlElementNillable xmlElementNillable) Add a package name/XmlElementNillable entry to the map. This method will lazy-load the map if necessary. -
addPackageToXmlNullPolicy
Add a package name/XmlNullPolicy entry to the map. This method will lazy-load the map if necessary. -
addPackageToPackageInfoMapping
-
getPackageInfoForPackage
-
getPackageInfoForPackage
-
findInfoForNamespace
-
getMarshalCallbacks
-
getUnmarshalCallbacks
-
processObjectFactory
-
getGlobalElements
Lazy load and return the map of global elements. -
updateGlobalElements
-
getCollectionClassesToGeneratedClasses
-
getArrayClassesToGeneratedClasses
-
getGeneratedClassesToCollectionClasses
-
getGeneratedClassesToArrayClasses
-
getTypeInfosForPackage
Convenience method for returning all of the TypeInfo objects for a given package name. This method is inefficient as we need to iterate over the entire typeinfo map for each call. We should eventually store the TypeInfos in a Map based on package name, i.e.: Map <String, Map<String, TypeInfo>>- Returns:
- List of TypeInfo objects for a given package name
-
setPackageToNamespaceMappings
Set namespace override info from XML bindings file. This will typically be called from the XMLProcessor. -
setPackageToPackageInfoMappings
public void setPackageToPackageInfoMappings(HashMap<String, PackageInfo> packageToPackageInfoMappings) -
addClass
-
buildNewTypeInfo
Convenience method which class pre and postBuildTypeInfo for a given set of JavaClasses. -
isDefaultNamespaceAllowed
public boolean isDefaultNamespaceAllowed() -
getLocalElements
-
getTypeMappingInfosToGeneratedClasses
-
getTypeMappingInfoToAdapterClasses
-
addXmlRegistry
Add an XmlRegistry to ObjectFactory class name pair to the map.- Parameters:
factoryClassName
- ObjectFactory class namexmlReg
- org.eclipse.persistence.jaxb.xmlmodel.XmlRegistry instance
-
getTypeMappingInfosToSchemaTypes
-
setDefaultNamespaceAllowed
public void setDefaultNamespaceAllowed(boolean isDefaultNamespaceAllowed) -
isMtomAttachment
Indicates if a given Property represents an MTOM attachment. Will return true if the given Property's actual type is one of: - DataHandler - byte[] - Byte[] - Image - Source - MimeMultipart -
hasSwaRef
public boolean hasSwaRef() -
setHasSwaRef
public void setHasSwaRef(boolean swaRef) -
getReferencedByTransformer
-
isXmlAccessorFactorySupport
public boolean isXmlAccessorFactorySupport()Indicates whether this AnnotationsProcessor has been configured to enable processing of XmlAccessorFactory annotations.- See Also:
-
setXmlAccessorFactorySupport
public void setXmlAccessorFactorySupport(boolean value) Sets whether this AnnotationsProcessor should process XmlAccessorFactory annotations.- See Also:
-
setHasXmlBindings
public void setHasXmlBindings(boolean b) -
hasXmlBindings
public boolean hasXmlBindings()
-