public 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 |
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.HashMap<javax.xml.namespace.QName,ElementDeclaration> |
getGlobalElements()
Lazy load and return the map of global elements.
|
java.util.List<ElementDeclaration> |
getLocalElements() |
java.util.HashMap<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.HashMap<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.HashMap<java.lang.String,TypeInfo> |
getTypeInfo() |
java.util.ArrayList<JavaClass> |
getTypeInfoClasses() |
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> |
getTypeMappingInfoToAdapterClasses() |
java.util.Map<TypeMappingInfo,java.lang.Class> |
getTypeMappingInfoToGeneratedClasses() |
java.util.Map<TypeMappingInfo,javax.xml.namespace.QName> |
getTypeMappingInfoToSchemaType() |
java.util.HashMap<java.lang.String,UnmarshalCallback> |
getUnmarshalCallbacks() |
java.util.HashMap<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,
|
java.util.Map<java.lang.String,TypeInfo> |
preBuildTypeInfo(JavaClass[] javaClasses)
Process class level annotations only.
|
void |
processJavaClasses(JavaClass[] classes)
This method was initially designed to handle processing one or more
JavaClass instances.
|
NamespaceInfo |
processNamespaceInformation(XmlSchema xmlSchema) |
JavaClass[] |
processObjectFactory(JavaClass objectFactoryClass,
java.util.ArrayList<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 void processJavaClasses(JavaClass[] classes)
classes
- this paramater can and should be null as it is not usedpublic 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
- tgt
- 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.HashMap<java.lang.String,TypeInfo> getTypeInfo()
public java.util.ArrayList<JavaClass> getTypeInfoClasses()
public java.util.HashMap<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.HashMap<java.lang.String,PackageInfo> getPackageToPackageInfoMappings()
public void addPackageToNamespaceMapping(java.lang.String packageName, NamespaceInfo nsInfo)
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.HashMap<java.lang.String,MarshalCallback> getMarshalCallbacks()
public java.util.HashMap<java.lang.String,UnmarshalCallback> getUnmarshalCallbacks()
public JavaClass[] processObjectFactory(JavaClass objectFactoryClass, java.util.ArrayList<JavaClass> classes)
public java.util.HashMap<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> getTypeMappingInfoToGeneratedClasses()
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> getTypeMappingInfoToSchemaType()
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()
com.sun.xml.bind.XmlAccessorFactory
public void setXmlAccessorFactorySupport(boolean value)
com.sun.xml.bind.XmlAccessorFactory
public void setHasXmlBindings(boolean b)
public boolean hasXmlBindings()