EclipseLink 2.0.0, build 'v20091127-r5931' 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.
 void generateAnyAttributeMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLAnyCollectionMapping generateAnyCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, boolean isMixed)
           
 void generateAnyObjectMapping(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)
           
 void generateCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property, XMLDescriptor descriptor, 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)
           
 void generateDirectEnumerationMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo enumInfo)
           
 XMLDirectMapping generateDirectMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 void generateEnumCollectionMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo info)
           
 XMLCompositeCollectionMapping generateMapMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 void generateMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 XMLMapping generateMappingForReferenceProperty(ReferenceProperty property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 void generateMappings()
           
 void generateMappings(TypeInfo info, XMLDescriptor descriptor, NamespaceInfo namespaceInfo)
           
 Project generateProject(java.util.ArrayList<JavaClass> typeInfoClasses, java.util.HashMap<java.lang.String,TypeInfo> typeInfo, java.util.HashMap userDefinedSchemaTypes, java.util.HashMap<java.lang.String,NamespaceInfo> packageToNamespaceMappings, java.util.HashMap<javax.xml.namespace.QName,ElementDeclaration> globalElements, boolean isDefaultNamespaceAllowed)
           
 java.lang.Class generateWrapperClass(java.lang.String className, java.lang.String attributeType, boolean isList, javax.xml.namespace.QName theQName)
           
 void generateXMLCollectionReferenceMapping(Property property, XMLDescriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass)
          Create an XMLCollectionReferenceMapping and add it to the descriptor.
 void 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()
           
 java.lang.String getPrefixForNamespace(java.lang.String URI, NamespaceResolver namespaceResolver, java.lang.String suggestedPrefix)
           
 java.lang.String getPrefixForNamespace(java.lang.String URI, NamespaceResolver namespaceResolver, java.lang.String suggestedPrefix, 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 isCollectionType(JavaClass type)
           
 boolean isCollectionType(Property field)
           
 boolean isMapType(Property property)
           
 void processGlobalElements(Project project)
           
 void processSchemaType(XmlSchemaType type)
           
 
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 userDefinedSchemaTypes,
                               java.util.HashMap<java.lang.String,NamespaceInfo> packageToNamespaceMappings,
                               java.util.HashMap<javax.xml.namespace.QName,ElementDeclaration> globalElements,
                               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 void generateMapping(Property property,
                            XMLDescriptor descriptor,
                            NamespaceInfo namespaceInfo)

generateChoiceMapping

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

generateChoiceCollectionMapping

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

generateMappingForReferenceProperty

public XMLMapping generateMappingForReferenceProperty(ReferenceProperty 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)

generateDirectEnumerationMapping

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

generateCollectionMapping

public void generateCollectionMapping(Property property,
                                      XMLDescriptor descriptor,
                                      NamespaceInfo namespaceInfo)

generateEnumCollectionMapping

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

generateAnyAttributeMapping

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

generateAnyObjectMapping

public void 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:

generateMapMapping

public XMLCompositeCollectionMapping generateMapMapping(Property property,
                                                        XMLDescriptor descriptor,
                                                        NamespaceInfo namespaceInfo)

generateCompositeCollectionMapping

public XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property,
                                                                        XMLDescriptor descriptor,
                                                                        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,
                                              java.lang.String suggestedPrefix)

getPrefixForNamespace

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

isCollectionType

public boolean isCollectionType(Property field)

isCollectionType

public boolean isCollectionType(JavaClass type)

generateMappings

public void generateMappings()

generateMappings

public void generateMappings(TypeInfo info,
                             XMLDescriptor descriptor,
                             NamespaceInfo namespaceInfo)

generateXMLCollectionReferenceMapping

public void 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 void 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)

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)

processSchemaType

public void processSchemaType(XmlSchemaType type)

getSchemaTypeNameForClassName

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

isMapType

public boolean isMapType(Property property)

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()

EclipseLink 2.0.0, build 'v20091127-r5931' API Reference