Module org.eclipse.persistence.moxy
Class MappingsGenerator
java.lang.Object
org.eclipse.persistence.jaxb.compiler.MappingsGenerator
INTERNAL:
Purpose:To generate a TopLink OXM Project based on Java Class and TypeInfo information
Responsibilities:
- Generate a XMLDescriptor for each TypeInfo object
- Generate a mapping for each TypeProperty object
- Determine the correct mapping type based on the type of each property
- Set up Converters on mappings for XmlAdapters or JDK 1.5 Enumeration types.
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.
- Since:
- Oracle TopLink 11.1.1.0.0
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected boolean
Compares a JavaModel JavaClass to a Class.generateAnyAttributeMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) generateAnyCollectionMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, boolean isMixed) generateAnyObjectMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) generateBinaryDataCollectionMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) generateBinaryMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) generateChoiceCollectionMapping
(Property property, Descriptor descriptor, NamespaceInfo namespace) generateChoiceMapping
(Property property, Descriptor descriptor, NamespaceInfo namespace) generateCollectionMapping
(Property property, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) generateCompositeCollectionMapping
(Property property, Descriptor descriptor, JavaClass javaClass, NamespaceInfo namespaceInfo, String referenceClassName) generateCompositeObjectMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, String referenceClassName) void
generateDescriptor
(JavaClass javaClass, CoreProject project) void
generateDescriptorForJAXBElementSubclass
(JavaClass javaClass, CoreProject project, NamespaceResolver nsr) generateDirectCollectionMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) generateDirectEnumerationMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo enumInfo) generateDirectMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) generateEnumCollectionMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo info) generateMapping
(Property property, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) Generate a mapping for a given Property.generateMappingForReferenceProperty
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) void
void
generateMappings
(TypeInfo info, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) Generate mappings for a given TypeInfo.generateProject
(List<JavaClass> typeInfoClasses, Map<String, TypeInfo> typeInfo, Map<String, QName> userDefinedSchemaTypes, Map<String, PackageInfo> packageToPackageInfoMappings, Map<QName, ElementDeclaration> globalElements, List<ElementDeclaration> localElements, Map<TypeMappingInfo, Class<?>> typeMappingInfoToGeneratedClass, Map<TypeMappingInfo, Class<?>> typeMappingInfoToAdapterClasses, boolean isDefaultNamespaceAllowed) generateTransformationMapping
(Property property, Descriptor descriptor, NamespaceInfo namespace) Generate an XMLTransformationMapping based on a given Property.Class
<?> generateWrapperClass
(String className, String attributeType, boolean isList, QName theQName) generateXMLCollectionReferenceMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass) Create an XMLCollectionReferenceMapping and add it to the descriptor.generateXMLObjectReferenceMapping
(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass) Create an XMLObjectReferenceMapping and add it to the descriptor.getPrefixForNamespace
(String URI, NamespaceResolver namespaceResolver) getPrefixForNamespace
(String URI, NamespaceResolver namespaceResolver, boolean addPrefixToNR) getSchemaTypeNameForClassName
(String className) getXmlValueFieldForSimpleContent
(ArrayList<Property> properties) getXPathForElement
(String path, QName elementName, NamespaceInfo namespaceInfo, boolean isText) getXPathForField
(Property property, NamespaceInfo namespaceInfo, boolean isTextMapping, boolean isAny) void
processGlobalElements
(CoreProject project)
-
Field Details
-
RESERVED_QNAME
-
-
Constructor Details
-
MappingsGenerator
-
-
Method Details
-
generateProject
public CoreProject generateProject(List<JavaClass> typeInfoClasses, Map<String, TypeInfo> typeInfo, Map<String, throws ExceptionQName> userDefinedSchemaTypes, Map<String, PackageInfo> packageToPackageInfoMappings, Map<QName, ElementDeclaration> globalElements, List<ElementDeclaration> localElements, Map<TypeMappingInfo, Class<?>> typeMappingInfoToGeneratedClass, Map<TypeMappingInfo, Class<?>> typeMappingInfoToAdapterClasses, boolean isDefaultNamespaceAllowed) - Throws:
Exception
-
generateDescriptor
-
generateDescriptorForJAXBElementSubclass
public void generateDescriptorForJAXBElementSubclass(JavaClass javaClass, CoreProject project, NamespaceResolver nsr) -
generateMapping
public Mapping generateMapping(Property property, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) Generate a mapping for a given Property.- Returns:
- newly created mapping
-
generateTransformationMapping
public TransformationMapping generateTransformationMapping(Property property, Descriptor descriptor, NamespaceInfo namespace) Generate an XMLTransformationMapping based on a given Property. -
generateChoiceMapping
public ChoiceObjectMapping generateChoiceMapping(Property property, Descriptor descriptor, NamespaceInfo namespace) -
generateChoiceCollectionMapping
public ChoiceCollectionMapping generateChoiceCollectionMapping(Property property, Descriptor descriptor, NamespaceInfo namespace) -
generateMappingForReferenceProperty
public Mapping generateMappingForReferenceProperty(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) -
generateAnyCollectionMapping
public AnyCollectionMapping generateAnyCollectionMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, boolean isMixed) -
generateCompositeObjectMapping
public CompositeObjectMapping generateCompositeObjectMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, String referenceClassName) -
generateDirectMapping
public DirectMapping generateDirectMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) -
generateBinaryMapping
public BinaryDataMapping generateBinaryMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) -
generateBinaryDataCollectionMapping
public BinaryDataCollectionMapping generateBinaryDataCollectionMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) -
generateDirectEnumerationMapping
public DirectMapping generateDirectEnumerationMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo enumInfo) -
generateCollectionMapping
public Mapping generateCollectionMapping(Property property, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) -
generateEnumCollectionMapping
public DirectCollectionMapping generateEnumCollectionMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, EnumTypeInfo info) -
generateAnyAttributeMapping
public AnyAttributeMapping generateAnyAttributeMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) -
generateAnyObjectMapping
public AnyObjectMapping generateAnyObjectMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) -
areEquals
-
areEquals
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. -
generateCompositeCollectionMapping
public CompositeCollectionMapping generateCompositeCollectionMapping(Property property, Descriptor descriptor, JavaClass javaClass, NamespaceInfo namespaceInfo, String referenceClassName) -
generateDirectCollectionMapping
public DirectCollectionMapping generateDirectCollectionMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo) -
getPrefixForNamespace
-
getPrefixForNamespace
public String getPrefixForNamespace(String URI, NamespaceResolver namespaceResolver, boolean addPrefixToNR) -
generateMappings
public void generateMappings() -
generateMappings
public void generateMappings(TypeInfo info, Descriptor descriptor, JavaClass descriptorJavaClass, NamespaceInfo namespaceInfo) Generate mappings for a given TypeInfo. -
generateXMLCollectionReferenceMapping
public CollectionReferenceMapping generateXMLCollectionReferenceMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass) Create an XMLCollectionReferenceMapping and add it to the descriptor. -
generateXMLObjectReferenceMapping
public ObjectReferenceMapping generateXMLObjectReferenceMapping(Property property, Descriptor descriptor, NamespaceInfo namespaceInfo, JavaClass referenceClass) Create an XMLObjectReferenceMapping and add it to the descriptor. -
getXPathForField
public Field getXPathForField(Property property, NamespaceInfo namespaceInfo, boolean isTextMapping, boolean isAny) -
getXPathForElement
public Field getXPathForElement(String path, QName elementName, NamespaceInfo namespaceInfo, boolean isText) -
getXmlValueFieldForSimpleContent
-
getSchemaTypeNameForClassName
-
processGlobalElements
-
generateWrapperClass
-
getQNamesToGeneratedClasses
-
getClassToGeneratedClasses
-
getQNamesToDeclaredClasses
-
getJaxbClassLoader
-