public final class AnnotationsProcessor
extends java.lang.Object
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:
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.
Generator
Constructor and Description |
---|
AnnotationsProcessor(Helper helper) |
Modifier and Type | Method and Description |
---|---|
SchemaTypeInfo |
addClass(JavaClass javaClass) |
void |
addEnumTypeInfo(JavaClass javaClass,
EnumTypeInfo info) |
void |
addPackageToNamespaceMapping(java.lang.String packageName,
NamespaceInfo nsInfo)
Add a package name/NamespaceInfo entry to the map.
|
void |
addPackageToPackageInfoMapping(java.lang.String packageName,
PackageInfo packageInfo) |
void |
addPackageToXmlElementNillable(java.lang.String packageName,
XmlElementNillable xmlElementNillable)
Add a package name/XmlElementNillable entry to the map.
|
void |
addPackageToXmlNullPolicy(java.lang.String packageName,
XmlNullPolicy xmlNullPolicy)
Add a package name/XmlNullPolicy entry to the map.
|
void |
addXmlRegistry(java.lang.String factoryClassName,
XmlRegistry xmlReg)
Add an XmlRegistry to ObjectFactory class name pair to the map.
|
protected boolean |
areEquals(JavaClass src,
java.lang.Class tgt)
Compares a JavaModel JavaClass to a Class.
|
protected boolean |
areEquals(JavaClass src,
java.lang.String tgtCanonicalName)
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 |
createElementsForTypeMappingInfo() |
void |
finalizeProperties()
Perform any final generation and/or validation operations on TypeInfo
properties.
|
NamespaceInfo |
findInfoForNamespace(java.lang.String namespace) |
java.util.Map<java.lang.String,java.lang.Class> |
getArrayClassesToGeneratedClasses() |
java.util.Map<java.lang.reflect.Type,java.lang.Class> |
getCollectionClassesToGeneratedClasses() |
java.util.ArrayList<Property> |
getFieldPropertiesForClass(JavaClass cls,
TypeInfo info,
boolean onlyPublic) |
java.util.ArrayList<Property> |
getFieldPropertiesForClass(JavaClass cls,
TypeInfo info,
boolean onlyPublic,
boolean onlyExplicit) |
java.util.Map<java.lang.Class,JavaClass> |
getGeneratedClassesToArrayClasses() |
java.util.Map<java.lang.Class,java.lang.reflect.Type> |
getGeneratedClassesToCollectionClasses() |
java.util.Map<javax.xml.namespace.QName,ElementDeclaration> |
getGlobalElements()
Lazy load and return the map of global elements.
|
java.util.List<ElementDeclaration> |
getLocalElements() |
java.util.Map<java.lang.String,MarshalCallback> |
getMarshalCallbacks() |
java.util.ArrayList |
getNoAccessTypePropertiesForClass(JavaClass cls,
TypeInfo info) |
PackageInfo |
getPackageInfoForPackage(JavaClass javaClass) |
PackageInfo |
getPackageInfoForPackage(JavaPackage pack,
java.lang.String packageName) |
java.util.Map<java.lang.String,PackageInfo> |
getPackageToPackageInfoMappings() |
java.util.ArrayList<Property> |
getPropertiesForClass(JavaClass cls,
TypeInfo info) |
java.util.HashMap<java.lang.String,Property> |
getPropertyMapFromArrayList(java.util.ArrayList<Property> props) |
java.util.ArrayList<Property> |
getPropertyPropertiesForClass(JavaClass cls,
TypeInfo info,
boolean onlyPublic) |
java.util.ArrayList<Property> |
getPropertyPropertiesForClass(JavaClass cls,
TypeInfo info,
boolean onlyPublic,
boolean onlyExplicit) |
java.util.ArrayList |
getPublicMemberPropertiesForClass(JavaClass cls,
TypeInfo info) |
javax.xml.namespace.QName |
getQNameForProperty(Property property,
java.lang.String defaultName,
JavaHasAnnotations element,
NamespaceInfo namespaceInfo,
TypeInfo info) |
java.util.List |
getReferencedByTransformer() |
javax.xml.namespace.QName |
getSchemaTypeFor(JavaClass javaClass) |
javax.xml.namespace.QName |
getSchemaTypeOrNullFor(JavaClass javaClass) |
java.util.List<JavaClass> |
getTypeInfoClasses() |
java.util.Map<java.lang.String,TypeInfo> |
getTypeInfos() |
java.util.Map<java.lang.String,TypeInfo> |
getTypeInfosForPackage(java.lang.String packageName)
Convenience method for returning all of the TypeInfo objects for a given
package name.
|
java.util.Map<TypeMappingInfo,java.lang.Class> |
getTypeMappingInfosToGeneratedClasses() |
java.util.Map<TypeMappingInfo,javax.xml.namespace.QName> |
getTypeMappingInfosToSchemaTypes() |
java.util.Map<TypeMappingInfo,java.lang.Class> |
getTypeMappingInfoToAdapterClasses() |
java.util.Map<java.lang.String,UnmarshalCallback> |
getUnmarshalCallbacks() |
java.util.Map<java.lang.String,javax.xml.namespace.QName> |
getUserDefinedSchemaTypes() |
boolean |
hasSwaRef() |
boolean |
hasXmlBindings() |
boolean |
isDefaultNamespaceAllowed() |
boolean |
isMtomAttachment(Property property)
Indicates if a given Property represents an MTOM attachment.
|
boolean |
isXmlAccessorFactorySupport()
Indicates whether this AnnotationsProcessor has been configured to enable
processing of XmlAccessorFactory annotations.
|
JavaClass[] |
postBuildTypeInfo(JavaClass[] javaClasses)
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.
|
java.util.Map<java.lang.String,TypeInfo> |
preBuildTypeInfo(JavaClass[] javaClasses)
Process class level annotations only.
|
NamespaceInfo |
processNamespaceInformation(XmlSchema xmlSchema) |
JavaClass[] |
processObjectFactory(JavaClass objectFactoryClass,
java.util.List<JavaClass> classes) |
void |
processPropertiesSuperClass(JavaClass cls,
TypeInfo info) |
void |
processSchemaType(java.lang.String name,
java.lang.String namespace,
java.lang.String jClassQualifiedName)
Use name, namespace and type information to setup a user-defined schema
type.
|
void |
processSchemaType(XmlSchemaType type) |
void |
setDefaultNamespaceAllowed(boolean isDefaultNamespaceAllowed) |
void |
setHasSwaRef(boolean swaRef) |
void |
setHasXmlBindings(boolean b) |
void |
setPackageToNamespaceMappings(java.util.HashMap<java.lang.String,NamespaceInfo> packageToNamespaceMappings)
Set namespace override info from XML bindings file.
|
void |
setPackageToPackageInfoMappings(java.util.HashMap<java.lang.String,PackageInfo> packageToPackageInfoMappings) |
void |
setXmlAccessorFactorySupport(boolean value)
Sets whether this AnnotationsProcessor should process XmlAccessorFactory annotations.
|
boolean |
shouldGenerateTypeInfo(JavaClass javaClass) |
void |
updateGlobalElements(JavaClass[] classesToProcess) |
public AnnotationsProcessor(Helper helper)
public void createElementsForTypeMappingInfo()
public java.util.Map<java.lang.String,TypeInfo> preBuildTypeInfo(JavaClass[] javaClasses)
javaClasses
- public JavaClass[] postBuildTypeInfo(JavaClass[] javaClasses)
javaClasses
- public void finalizeProperties()
public boolean shouldGenerateTypeInfo(JavaClass javaClass)
public java.util.ArrayList<Property> getPropertiesForClass(JavaClass cls, TypeInfo info)
public java.util.ArrayList<Property> getFieldPropertiesForClass(JavaClass cls, TypeInfo info, boolean onlyPublic)
public java.util.ArrayList<Property> getFieldPropertiesForClass(JavaClass cls, TypeInfo info, boolean onlyPublic, boolean onlyExplicit)
protected boolean areEquals(JavaClass src, java.lang.Class tgt)
src
- tgt
- protected boolean areEquals(JavaClass src, java.lang.String tgtCanonicalName)
src
- tgtCanonicalName
- public java.util.ArrayList<Property> getPropertyPropertiesForClass(JavaClass cls, TypeInfo info, boolean onlyPublic)
public java.util.ArrayList<Property> getPropertyPropertiesForClass(JavaClass cls, TypeInfo info, boolean onlyPublic, boolean onlyExplicit)
public java.util.ArrayList getPublicMemberPropertiesForClass(JavaClass cls, TypeInfo info)
public java.util.HashMap<java.lang.String,Property> getPropertyMapFromArrayList(java.util.ArrayList<Property> props)
public java.util.ArrayList getNoAccessTypePropertiesForClass(JavaClass cls, TypeInfo info)
public void processSchemaType(java.lang.String name, java.lang.String namespace, java.lang.String jClassQualifiedName)
name
- namespace
- jClassQualifiedName
- public void processSchemaType(XmlSchemaType type)
public void addEnumTypeInfo(JavaClass javaClass, EnumTypeInfo info)
public javax.xml.namespace.QName getSchemaTypeOrNullFor(JavaClass javaClass)
public javax.xml.namespace.QName getSchemaTypeFor(JavaClass javaClass)
public NamespaceInfo processNamespaceInformation(XmlSchema xmlSchema)
public java.util.Map<java.lang.String,TypeInfo> getTypeInfos()
public java.util.List<JavaClass> getTypeInfoClasses()
public java.util.Map<java.lang.String,javax.xml.namespace.QName> getUserDefinedSchemaTypes()
public javax.xml.namespace.QName getQNameForProperty(Property property, java.lang.String defaultName, JavaHasAnnotations element, NamespaceInfo namespaceInfo, TypeInfo info)
public java.util.Map<java.lang.String,PackageInfo> getPackageToPackageInfoMappings()
public void addPackageToNamespaceMapping(java.lang.String packageName, NamespaceInfo nsInfo)
public void addPackageToXmlElementNillable(java.lang.String packageName, XmlElementNillable xmlElementNillable)
public void addPackageToXmlNullPolicy(java.lang.String packageName, XmlNullPolicy xmlNullPolicy)
public void addPackageToPackageInfoMapping(java.lang.String packageName, PackageInfo packageInfo)
public PackageInfo getPackageInfoForPackage(JavaClass javaClass)
public PackageInfo getPackageInfoForPackage(JavaPackage pack, java.lang.String packageName)
public NamespaceInfo findInfoForNamespace(java.lang.String namespace)
public java.util.Map<java.lang.String,MarshalCallback> getMarshalCallbacks()
public java.util.Map<java.lang.String,UnmarshalCallback> getUnmarshalCallbacks()
public JavaClass[] processObjectFactory(JavaClass objectFactoryClass, java.util.List<JavaClass> classes)
public java.util.Map<javax.xml.namespace.QName,ElementDeclaration> getGlobalElements()
public void updateGlobalElements(JavaClass[] classesToProcess)
public java.util.Map<java.lang.reflect.Type,java.lang.Class> getCollectionClassesToGeneratedClasses()
public java.util.Map<java.lang.String,java.lang.Class> getArrayClassesToGeneratedClasses()
public java.util.Map<java.lang.Class,java.lang.reflect.Type> getGeneratedClassesToCollectionClasses()
public java.util.Map<java.lang.Class,JavaClass> getGeneratedClassesToArrayClasses()
public java.util.Map<java.lang.String,TypeInfo> getTypeInfosForPackage(java.lang.String packageName)
packageName
- public void setPackageToNamespaceMappings(java.util.HashMap<java.lang.String,NamespaceInfo> packageToNamespaceMappings)
packageToNamespaceMappings
- public void setPackageToPackageInfoMappings(java.util.HashMap<java.lang.String,PackageInfo> packageToPackageInfoMappings)
public SchemaTypeInfo addClass(JavaClass javaClass)
public void buildNewTypeInfo(JavaClass[] javaClasses)
javaClasses
- public boolean isDefaultNamespaceAllowed()
public java.util.List<ElementDeclaration> getLocalElements()
public java.util.Map<TypeMappingInfo,java.lang.Class> getTypeMappingInfosToGeneratedClasses()
public java.util.Map<TypeMappingInfo,java.lang.Class> getTypeMappingInfoToAdapterClasses()
public void addXmlRegistry(java.lang.String factoryClassName, XmlRegistry xmlReg)
factoryClassName
- ObjectFactory class namexmlReg
- org.eclipse.persistence.jaxb.xmlmodel.XmlRegistry instancepublic java.util.Map<TypeMappingInfo,javax.xml.namespace.QName> getTypeMappingInfosToSchemaTypes()
public void setDefaultNamespaceAllowed(boolean isDefaultNamespaceAllowed)
public boolean isMtomAttachment(Property property)
property
- public boolean hasSwaRef()
public void setHasSwaRef(boolean swaRef)
public java.util.List getReferencedByTransformer()
public boolean isXmlAccessorFactorySupport()
XmlAccessorFactory
public void setXmlAccessorFactorySupport(boolean value)
XmlAccessorFactory
public void setHasXmlBindings(boolean b)
public boolean hasXmlBindings()