public class MappingsGenerator
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
static javax.xml.namespace.QName |
RESERVED_QNAME |
Constructor and Description |
---|
MappingsGenerator(Helper helper) |
Modifier and Type | Method and Description |
---|---|
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.
|
org.eclipse.persistence.internal.oxm.mappings.AnyAttributeMapping |
generateAnyAttributeMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo) |
org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping |
generateAnyCollectionMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo,
boolean isMixed) |
org.eclipse.persistence.internal.oxm.mappings.AnyObjectMapping |
generateAnyObjectMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo) |
org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping |
generateBinaryDataCollectionMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo) |
org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping |
generateBinaryMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo) |
org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping |
generateChoiceCollectionMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespace) |
org.eclipse.persistence.internal.oxm.mappings.ChoiceObjectMapping |
generateChoiceMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespace) |
org.eclipse.persistence.internal.oxm.mappings.Mapping |
generateCollectionMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
JavaClass descriptorJavaClass,
NamespaceInfo namespaceInfo) |
org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping |
generateCompositeCollectionMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
JavaClass javaClass,
NamespaceInfo namespaceInfo,
java.lang.String referenceClassName) |
org.eclipse.persistence.internal.oxm.mappings.CompositeObjectMapping |
generateCompositeObjectMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo,
java.lang.String referenceClassName) |
void |
generateDescriptor(JavaClass javaClass,
CoreProject project) |
void |
generateDescriptorForJAXBElementSubclass(JavaClass javaClass,
CoreProject project,
org.eclipse.persistence.internal.oxm.NamespaceResolver nsr) |
org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping |
generateDirectCollectionMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo) |
org.eclipse.persistence.internal.oxm.mappings.DirectMapping |
generateDirectEnumerationMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo,
EnumTypeInfo enumInfo) |
org.eclipse.persistence.internal.oxm.mappings.DirectMapping |
generateDirectMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo) |
org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping |
generateEnumCollectionMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo,
EnumTypeInfo info) |
org.eclipse.persistence.internal.oxm.mappings.Mapping |
generateMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
JavaClass descriptorJavaClass,
NamespaceInfo namespaceInfo)
Generate a mapping for a given Property.
|
org.eclipse.persistence.internal.oxm.mappings.Mapping |
generateMappingForReferenceProperty(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo) |
void |
generateMappings() |
void |
generateMappings(TypeInfo info,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
JavaClass descriptorJavaClass,
NamespaceInfo namespaceInfo)
Generate mappings for a given TypeInfo.
|
CoreProject |
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) |
org.eclipse.persistence.internal.oxm.mappings.TransformationMapping |
generateTransformationMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor 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) |
org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping |
generateXMLCollectionReferenceMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor,
NamespaceInfo namespaceInfo,
JavaClass referenceClass)
Create an XMLCollectionReferenceMapping and add it to the descriptor.
|
org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping |
generateXMLObjectReferenceMapping(Property property,
org.eclipse.persistence.internal.oxm.mappings.Descriptor 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,
org.eclipse.persistence.internal.oxm.NamespaceResolver namespaceResolver) |
java.lang.String |
getPrefixForNamespace(java.lang.String URI,
org.eclipse.persistence.internal.oxm.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) |
org.eclipse.persistence.internal.oxm.mappings.Field |
getXPathForElement(java.lang.String path,
javax.xml.namespace.QName elementName,
NamespaceInfo namespaceInfo,
boolean isText) |
org.eclipse.persistence.internal.oxm.mappings.Field |
getXPathForField(Property property,
NamespaceInfo namespaceInfo,
boolean isTextMapping,
boolean isAny) |
void |
processGlobalElements(CoreProject project) |
public MappingsGenerator(Helper helper)
public CoreProject 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
java.lang.Exception
public void generateDescriptor(JavaClass javaClass, CoreProject project)
public void generateDescriptorForJAXBElementSubclass(JavaClass javaClass, CoreProject project, org.eclipse.persistence.internal.oxm.NamespaceResolver nsr)
public org.eclipse.persistence.internal.oxm.mappings.Mapping generateMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo)
property
- descriptor
- namespaceInfo
- public org.eclipse.persistence.internal.oxm.mappings.TransformationMapping generateTransformationMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespace)
property
- descriptor
- namespace
- public org.eclipse.persistence.internal.oxm.mappings.ChoiceObjectMapping generateChoiceMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespace)
public org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping generateChoiceCollectionMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespace)
public org.eclipse.persistence.internal.oxm.mappings.Mapping generateMappingForReferenceProperty(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo)
public org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping generateAnyCollectionMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo, boolean isMixed)
public org.eclipse.persistence.internal.oxm.mappings.CompositeObjectMapping generateCompositeObjectMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo, java.lang.String referenceClassName)
public org.eclipse.persistence.internal.oxm.mappings.DirectMapping generateDirectMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo)
public org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping generateBinaryMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo)
public org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping generateBinaryDataCollectionMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo)
public org.eclipse.persistence.internal.oxm.mappings.DirectMapping generateDirectEnumerationMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo enumInfo)
public org.eclipse.persistence.internal.oxm.mappings.Mapping generateCollectionMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo)
public org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping generateEnumCollectionMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo info)
public org.eclipse.persistence.internal.oxm.mappings.AnyAttributeMapping generateAnyAttributeMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo)
public org.eclipse.persistence.internal.oxm.mappings.AnyObjectMapping generateAnyObjectMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo)
protected boolean areEquals(JavaClass src, java.lang.Class tgt)
protected boolean areEquals(JavaClass src, java.lang.String tgtCanonicalName)
src
- tgt
- public org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping generateCompositeCollectionMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, JavaClass javaClass, NamespaceInfo namespaceInfo, java.lang.String referenceClassName)
public org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping generateDirectCollectionMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo)
public java.lang.String getPrefixForNamespace(java.lang.String URI, org.eclipse.persistence.internal.oxm.NamespaceResolver namespaceResolver)
public java.lang.String getPrefixForNamespace(java.lang.String URI, org.eclipse.persistence.internal.oxm.NamespaceResolver namespaceResolver, boolean addPrefixToNR)
public void generateMappings()
public void generateMappings(TypeInfo info, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo)
info
- descriptor
- namespaceInfo
- public org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping generateXMLCollectionReferenceMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass)
property
- descriptor
- namespaceInfo
- referenceClass
- public org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping generateXMLObjectReferenceMapping(Property property, org.eclipse.persistence.internal.oxm.mappings.Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass)
property
- descriptor
- namespaceInfo
- referenceClass
- public org.eclipse.persistence.internal.oxm.mappings.Field getXPathForField(Property property, NamespaceInfo namespaceInfo, boolean isTextMapping, boolean isAny)
public org.eclipse.persistence.internal.oxm.mappings.Field getXPathForElement(java.lang.String path, javax.xml.namespace.QName elementName, NamespaceInfo namespaceInfo, boolean isText)
public Property getXmlValueFieldForSimpleContent(java.util.ArrayList<Property> properties)
public java.lang.String getSchemaTypeNameForClassName(java.lang.String className)
public void processGlobalElements(CoreProject project)
public java.lang.Class generateWrapperClass(java.lang.String className, java.lang.String attributeType, boolean isList, javax.xml.namespace.QName theQName)
public java.util.HashMap<javax.xml.namespace.QName,java.lang.Class> getQNamesToGeneratedClasses()
public java.util.HashMap<java.lang.String,java.lang.Class> getClassToGeneratedClasses()
public java.util.HashMap<javax.xml.namespace.QName,java.lang.Class> getQNamesToDeclaredClasses()
public org.eclipse.persistence.internal.jaxb.JaxbClassLoader getJaxbClassLoader()