Module org.eclipse.persistence.moxy
Class SchemaGenerator
java.lang.Object
org.eclipse.persistence.jaxb.compiler.SchemaGenerator
INTERNAL:
Purpose:To generate Schema objects based on a map of TypeInfo objects, and some additional information gathered by the AnnotationsProcessing phase.
Responsibilities:
- Create and maintain a collection of Schema objects based on the provided TypeInfo objects
- Add additional global elements to the schema based on an optional map (for WS integration)
- Should create a schema for each namespace encountered during generation.
This class is used by the Generator to handle the generation of Schemas. The Generator passes in a map of TypeInfo objects, generated by the Annotations processor. The generated Schemas are stored in a map of keyed on Target Namespace.
- Since:
- Oracle TopLink 11.1.1.0.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGlobalElements
(Map<QName, ElementDeclaration> additionalElements) void
addSchemaComponents
(JavaClass myClass) void
addToSchemaType
(TypeInfo ownerTypeInfo, List<Property> properties, TypeDefParticle compositor, ComplexType type, Schema workingSchema) protected boolean
Compares a JavaModel JavaClass to a Class.protected boolean
Compares a JavaModel JavaClass to a Class.createGlobalAttribute
(XPathFragment frag, Schema workingSchema, Schema fragSchema, Property prop) Create a global attribute.createGlobalElement
(XPathFragment frag, Schema workingSchema, Schema fragSchema, boolean isChoice, boolean isUnbounded, Property prop, boolean shouldSetType) Create a global element.createRefAttribute
(String attributeRefName, ComplexType owningComplexType) Create an attribute reference and add it to a given complex type.createRefElement
(String elementRefName, TypeDefParticle particle) Create an element reference and add it to a given particle.protected Element
elementExistsInParticle
(String elementName, String refString, TypeDefParticle particle) Convenience method for determining if an element already exists in a given typedefparticle.void
generateSchema
(List<JavaClass> typeInfoClasses, Map<String, TypeInfo> typeInfo, Map<String, QName> userDefinedSchemaTypes, Map<String, PackageInfo> packageToPackageInfoMappings, Map<QName, ElementDeclaration> additionalGlobalElements, Map<String, Class<?>> arrayClassesToGeneratedClasses) void
generateSchema
(List<JavaClass> typeInfoClasses, Map<String, TypeInfo> typeInfo, Map<String, QName> userDefinedSchemaTypes, Map<String, PackageInfo> packageToPackageInfoMappings, Map<QName, ElementDeclaration> additionalGlobalElements, Map<String, Class<?>> arrayClassesToGeneratedClasses, SchemaOutputResolver outputResolver) getNamespaceInfoForNamespace
(String namespace) getNamespaceInfoForNamespace
(String namespace, String packageName) getOrGeneratePrefixForNamespace
(String URI, Schema schema) Attempt to resolve the given URI to a prefix.getPrefixForNamespace
(Schema schema, String URI) getSchemaTypeFor
(JavaClass javaClass) Return the schema type (as QName) based on a given JavaClass.Return the Map of SchemaTypeInfo instances.getSchemaTypeNameForClassName
(String className) protected TransformerPropertyBuilder
getTransformerPropertyBuilder
(Property property, TypeInfo typeInfo) Returns TransformerPropertyBuilder which builds properties from xml transformers.boolean
isCollectionType
(Property field) Indicates if a given Property is a collection type.void
-
Constructor Details
-
SchemaGenerator
-
-
Method Details
-
generateSchema
public void generateSchema(List<JavaClass> typeInfoClasses, Map<String, TypeInfo> typeInfo, Map<String, QName> userDefinedSchemaTypes, Map<String, PackageInfo> packageToPackageInfoMappings, Map<QName, ElementDeclaration> additionalGlobalElements, Map<String, Class<?>> arrayClassesToGeneratedClasses, SchemaOutputResolver outputResolver) -
generateSchema
-
addSchemaComponents
-
addToSchemaType
public void addToSchemaType(TypeInfo ownerTypeInfo, List<Property> properties, TypeDefParticle compositor, ComplexType type, Schema workingSchema) -
getSchemaTypeFor
Return the schema type (as QName) based on a given JavaClass. -
populateSchemaTypes
public void populateSchemaTypes() -
getSchemaTypeNameForClassName
-
getEnumerationFacetsFor
-
getXmlValueFieldForSimpleContent
-
isCollectionType
Indicates if a given Property is a collection type. -
getAllSchemas
-
getNamespaceInfoForNamespace
-
getNamespaceInfoForNamespace
-
getPrefixForNamespace
-
getOrGeneratePrefixForNamespace
Attempt to resolve the given URI to a prefix. If this is unsuccessful, one will be generated and added to the resolver. -
addGlobalElements
-
getSchemaTypeInfo
Return the Map of SchemaTypeInfo instances. The Map is keyed on JavaClass qualified name. -
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. -
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. -
elementExistsInParticle
protected Element elementExistsInParticle(String elementName, String refString, TypeDefParticle particle) Convenience method for determining if an element already exists in a given typedefparticle. If an element exists whose ref is equal to 'refString' or its name is equal to 'elementName', it is returned. Null otherwise. Note that ref takes precidence, so if either has a ref set name equality will not be performed.- Parameters:
elementName
- the non-null element name to look forrefString
- if the element is a ref, this will be the prefix qualified element nameparticle
- the sequence/choice/all to search for an existing element
-
createGlobalAttribute
public Attribute createGlobalAttribute(XPathFragment frag, Schema workingSchema, Schema fragSchema, Property prop) Create a global attribute. An import is added if necessary. This method will typically be called when processing an XPath and a prefixed path element is encountered tha requires an attribute ref. -
createGlobalElement
public Element createGlobalElement(XPathFragment frag, Schema workingSchema, Schema fragSchema, boolean isChoice, boolean isUnbounded, Property prop, boolean shouldSetType) Create a global element. An import is added if necessary. This method will typically be called when processing an XPath and a prefixed path element is encountered the requires an element ref.- Parameters:
frag
- XPathFragment which wil lbe used to create the global elementworkingSchema
- current schemafragSchema
- frag's schemaisChoice
- indicates if we need to construct a choiceisUnbounded
- maxOccurs setting for choiceprop
- property which owns the xml-pathshouldSetType
- if this is the last fragment in the xml-path and not an 'any', we should set the type
-
createRefElement
Create an element reference and add it to a given particle. This method will typically be called when processing an XPath and a prefixed path element is encountered that requires an element ref. -
createRefAttribute
Create an attribute reference and add it to a given complex type. This method will typically be called when processing an XPath and a prefixed path element is encountered that requires an attribute ref. -
getTransformerPropertyBuilder
protected TransformerPropertyBuilder getTransformerPropertyBuilder(Property property, TypeInfo typeInfo) Returns TransformerPropertyBuilder which builds properties from xml transformers.- Parameters:
property
- property holding xml transformerstypeInfo
- typeInfo with transformer class- Returns:
- transformer property builder
-