EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jaxb.compiler
Class MappingsGenerator

java.lang.Object
  extended by org.eclipse.persistence.jaxb.compiler.MappingsGenerator

public class MappingsGenerator
extends java.lang.Object

INTERNAL:

Purpose:To generate a TopLink OXM Project based on Java Class and TypeInfo information

Responsibilities:

This class is invoked by a Generator in order to create a TopLink Project. This is generally used by JAXBContextFactory to create the runtime project. A Descriptor will be generated for each TypeInfo and Mappings generated for each Property. In the case that a non-transient property's type is a user defined class, a Descriptor and Mappings will be generated for that class as well.

See Also:
Generator, TypeInfo, Property
Author:
mmacivor
Since:
Oracle TopLink 11.1.1.0.0

Field Summary
static javax.xml.namespace.QName RESERVED_QNAME
           
 
Constructor Summary
MappingsGenerator(Helper helper)
           
 
Method Summary
protected  boolean areEquals(JavaClass src, java.lang.Class tgt)
           
protected  boolean areEquals(JavaClass src, java.lang.String tgtCanonicalName)
          Compares a JavaModel JavaClass to a Class.
 XMLAnyAttributeMapping generateAnyAttributeMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLAnyCollectionMapping generateAnyCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, boolean isMixed)
           
 XMLAnyObjectMapping generateAnyObjectMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLBinaryDataCollectionMapping generateBinaryDataCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLBinaryDataMapping generateBinaryMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLChoiceCollectionMapping generateChoiceCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespace)
           
 XMLChoiceObjectMapping generateChoiceMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespace)
           
 DatabaseMapping generateCollectionMapping(Property property, XMLDescriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo)
           
 XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property, XMLDescriptor descriptor, JavaClass javaClass, NamespaceInfo namespaceInfo, java.lang.String referenceClassName)
           
 XMLCompositeObjectMapping generateCompositeObjectMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, java.lang.String referenceClassName)
           
 void generateDescriptor(JavaClass javaClass, Project project)
           
 void generateDescriptorForJAXBElementSubclass(JavaClass javaClass, Project project, NamespaceResolver nsr)
           
 XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLDirectMapping generateDirectEnumerationMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo enumInfo)
           
 XMLDirectMapping generateDirectMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLCompositeDirectCollectionMapping generateEnumCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo info)
           
 DatabaseMapping generateMapping(Property property, XMLDescriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo)
          Generate a mapping for a given Property.
 DatabaseMapping generateMappingForReferenceProperty(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 void generateMappings()
           
 void generateMappings(TypeInfo info, XMLDescriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo)
          Generate mappings for a given TypeInfo.
 Project generateProject(java.util.ArrayList<JavaClass> typeInfoClasses, java.util.HashMap<java.lang.String,TypeInfo> typeInfo, java.util.HashMap<java.lang.String,javax.xml.namespace.QName> userDefinedSchemaTypes, java.util.HashMap<java.lang.String,PackageInfo> packageToPackageInfoMappings, java.util.HashMap<javax.xml.namespace.QName,ElementDeclaration> globalElements, java.util.List<ElementDeclaration> localElements, java.util.Map<TypeMappingInfo,java.lang.Class> typeMappingInfoToGeneratedClass, java.util.Map<TypeMappingInfo,java.lang.Class> typeMappingInfoToAdapterClasses, boolean isDefaultNamespaceAllowed)
           
 XMLTransformationMapping generateTransformationMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespace)
          Generate an XMLTransformationMapping based on a given Property.
 java.lang.Class generateWrapperClass(java.lang.String className, java.lang.String attributeType, boolean isList, javax.xml.namespace.QName theQName)
           
 XMLCollectionReferenceMapping generateXMLCollectionReferenceMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass)
          Create an XMLCollectionReferenceMapping and add it to the descriptor.
 XMLObjectReferenceMapping generateXMLObjectReferenceMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass)
          Create an XMLObjectReferenceMapping and add it to the descriptor.
 java.util.HashMap<java.lang.String,java.lang.Class> getClassToGeneratedClasses()
           
 org.eclipse.persistence.internal.jaxb.JaxbClassLoader getJaxbClassLoader()
           
 java.lang.String getPrefixForNamespace(java.lang.String URI, NamespaceResolver namespaceResolver)
           
 java.lang.String getPrefixForNamespace(java.lang.String URI, NamespaceResolver namespaceResolver, boolean addPrefixToNR)
           
 java.util.HashMap<javax.xml.namespace.QName,java.lang.Class> getQNamesToDeclaredClasses()
           
 java.util.HashMap<javax.xml.namespace.QName,java.lang.Class> getQNamesToGeneratedClasses()
           
 java.lang.String getSchemaTypeNameForClassName(java.lang.String className)
           
 Property getXmlValueFieldForSimpleContent(java.util.ArrayList<Property> properties)
           
 XMLField getXPathForElement(java.lang.String path, javax.xml.namespace.QName elementName, NamespaceInfo namespaceInfo, boolean isText)
           
 XMLField getXPathForField(Property property, NamespaceInfo namespaceInfo, boolean isTextMapping, boolean isAny)
           
 void processGlobalElements(Project project)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESERVED_QNAME

public static final javax.xml.namespace.QName RESERVED_QNAME
Constructor Detail

MappingsGenerator

public MappingsGenerator(Helper helper)
Method Detail

generateProject

public Project generateProject(java.util.ArrayList<JavaClass> typeInfoClasses,
                               java.util.HashMap<java.lang.String,TypeInfo> typeInfo,
                               java.util.HashMap<java.lang.String,javax.xml.namespace.QName> userDefinedSchemaTypes,
                               java.util.HashMap<java.lang.String,PackageInfo> packageToPackageInfoMappings,
                               java.util.HashMap<javax.xml.namespace.QName,ElementDeclaration> globalElements,
                               java.util.List<ElementDeclaration> localElements,
                               java.util.Map<TypeMappingInfo,java.lang.Class> typeMappingInfoToGeneratedClass,
                               java.util.Map<TypeMappingInfo,java.lang.Class> typeMappingInfoToAdapterClasses,
                               boolean isDefaultNamespaceAllowed)
                        throws java.lang.Exception
Throws:
java.lang.Exception

generateDescriptor

public void generateDescriptor(JavaClass javaClass,
                               Project project)

generateDescriptorForJAXBElementSubclass

public void generateDescriptorForJAXBElementSubclass(JavaClass javaClass,
                                                     Project project,
                                                     NamespaceResolver nsr)

generateMapping

public DatabaseMapping generateMapping(Property property,
                                       XMLDescriptor descriptor,
                                       JavaClass descriptorJavaClass,
                                       NamespaceInfo namespaceInfo)
Generate a mapping for a given Property.

Parameters:
property -
descriptor -
namespaceInfo -
Returns:
newly created mapping

generateTransformationMapping

public XMLTransformationMapping generateTransformationMapping(Property property,
                                                              XMLDescriptor descriptor,
                                                              NamespaceInfo namespace)
Generate an XMLTransformationMapping based on a given Property.

Parameters:
property -
descriptor -
namespace -
Returns:

generateChoiceMapping

public XMLChoiceObjectMapping generateChoiceMapping(Property property,
                                                    XMLDescriptor descriptor,
                                                    NamespaceInfo namespace)

generateChoiceCollectionMapping

public XMLChoiceCollectionMapping generateChoiceCollectionMapping(Property property,
                                                                  XMLDescriptor descriptor,
                                                                  NamespaceInfo namespace)

generateMappingForReferenceProperty

public DatabaseMapping generateMappingForReferenceProperty(Property property,
                                                           XMLDescriptor descriptor,
                                                           NamespaceInfo namespaceInfo)

generateAnyCollectionMapping

public XMLAnyCollectionMapping generateAnyCollectionMapping(Property property,
                                                            XMLDescriptor descriptor,
                                                            NamespaceInfo namespaceInfo,
                                                            boolean isMixed)

generateCompositeObjectMapping

public XMLCompositeObjectMapping generateCompositeObjectMapping(Property property,
                                                                XMLDescriptor descriptor,
                                                                NamespaceInfo namespaceInfo,
                                                                java.lang.String referenceClassName)

generateDirectMapping

public XMLDirectMapping generateDirectMapping(Property property,
                                              XMLDescriptor descriptor,
                                              NamespaceInfo namespaceInfo)

generateBinaryMapping

public XMLBinaryDataMapping generateBinaryMapping(Property property,
                                                  XMLDescriptor descriptor,
                                                  NamespaceInfo namespaceInfo)

generateBinaryDataCollectionMapping

public XMLBinaryDataCollectionMapping generateBinaryDataCollectionMapping(Property property,
                                                                          XMLDescriptor descriptor,
                                                                          NamespaceInfo namespaceInfo)

generateDirectEnumerationMapping

public XMLDirectMapping generateDirectEnumerationMapping(Property property,
                                                         XMLDescriptor descriptor,
                                                         NamespaceInfo namespaceInfo,
                                                         EnumTypeInfo enumInfo)

generateCollectionMapping

public DatabaseMapping generateCollectionMapping(Property property,
                                                 XMLDescriptor descriptor,
                                                 JavaClass descriptorJavaClass,
                                                 NamespaceInfo namespaceInfo)

generateEnumCollectionMapping

public XMLCompositeDirectCollectionMapping generateEnumCollectionMapping(Property property,
                                                                         XMLDescriptor descriptor,
                                                                         NamespaceInfo namespaceInfo,
                                                                         EnumTypeInfo info)

generateAnyAttributeMapping

public XMLAnyAttributeMapping generateAnyAttributeMapping(Property property,
                                                          XMLDescriptor descriptor,
                                                          NamespaceInfo namespaceInfo)

generateAnyObjectMapping

public XMLAnyObjectMapping generateAnyObjectMapping(Property property,
                                                    XMLDescriptor descriptor,
                                                    NamespaceInfo namespaceInfo)

areEquals

protected boolean areEquals(JavaClass src,
                            java.lang.Class tgt)

areEquals

protected boolean areEquals(JavaClass src,
                            java.lang.String tgtCanonicalName)
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.

Parameters:
src -
tgt -
Returns:

generateCompositeCollectionMapping

public XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property,
                                                                        XMLDescriptor descriptor,
                                                                        JavaClass javaClass,
                                                                        NamespaceInfo namespaceInfo,
                                                                        java.lang.String referenceClassName)

generateDirectCollectionMapping

public XMLCompositeDirectCollectionMapping generateDirectCollectionMapping(Property property,
                                                                           XMLDescriptor descriptor,
                                                                           NamespaceInfo namespaceInfo)

getPrefixForNamespace

public java.lang.String getPrefixForNamespace(java.lang.String URI,
                                              NamespaceResolver namespaceResolver)

getPrefixForNamespace

public java.lang.String getPrefixForNamespace(java.lang.String URI,
                                              NamespaceResolver namespaceResolver,
                                              boolean addPrefixToNR)

generateMappings

public void generateMappings()

generateMappings

public void generateMappings(TypeInfo info,
                             XMLDescriptor descriptor,
                             JavaClass descriptorJavaClass,
                             NamespaceInfo namespaceInfo)
Generate mappings for a given TypeInfo.

Parameters:
info -
descriptor -
namespaceInfo -

generateXMLCollectionReferenceMapping

public XMLCollectionReferenceMapping generateXMLCollectionReferenceMapping(Property property,
                                                                           XMLDescriptor descriptor,
                                                                           NamespaceInfo namespaceInfo,
                                                                           JavaClass referenceClass)
Create an XMLCollectionReferenceMapping and add it to the descriptor.

Parameters:
property -
descriptor -
namespaceInfo -
referenceClass -

generateXMLObjectReferenceMapping

public XMLObjectReferenceMapping generateXMLObjectReferenceMapping(Property property,
                                                                   XMLDescriptor descriptor,
                                                                   NamespaceInfo namespaceInfo,
                                                                   JavaClass referenceClass)
Create an XMLObjectReferenceMapping and add it to the descriptor.

Parameters:
property -
descriptor -
namespaceInfo -
referenceClass -

getXPathForField

public XMLField getXPathForField(Property property,
                                 NamespaceInfo namespaceInfo,
                                 boolean isTextMapping,
                                 boolean isAny)

getXPathForElement

public XMLField getXPathForElement(java.lang.String path,
                                   javax.xml.namespace.QName elementName,
                                   NamespaceInfo namespaceInfo,
                                   boolean isText)

getXmlValueFieldForSimpleContent

public Property getXmlValueFieldForSimpleContent(java.util.ArrayList<Property> properties)

getSchemaTypeNameForClassName

public java.lang.String getSchemaTypeNameForClassName(java.lang.String className)

processGlobalElements

public void processGlobalElements(Project project)

generateWrapperClass

public java.lang.Class generateWrapperClass(java.lang.String className,
                                            java.lang.String attributeType,
                                            boolean isList,
                                            javax.xml.namespace.QName theQName)

getQNamesToGeneratedClasses

public java.util.HashMap<javax.xml.namespace.QName,java.lang.Class> getQNamesToGeneratedClasses()

getClassToGeneratedClasses

public java.util.HashMap<java.lang.String,java.lang.Class> getClassToGeneratedClasses()

getQNamesToDeclaredClasses

public java.util.HashMap<javax.xml.namespace.QName,java.lang.Class> getQNamesToDeclaredClasses()

getJaxbClassLoader

public org.eclipse.persistence.internal.jaxb.JaxbClassLoader getJaxbClassLoader()

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference