public class SchemaGenerator extends Object
Purpose:To generate Schema objects based on a map of TypeInfo objects, and some additional information gathered by the AnnotationsProcessing phase.
Responsibilities:
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.
TypeInfo
,
AnnotationsProcessor
,
Generator
Constructor and Description |
---|
SchemaGenerator(Helper helper) |
Modifier and Type | Method and Description |
---|---|
void |
addGlobalElements(Map<QName,ElementDeclaration> additionalElements) |
void |
addSchemaComponents(JavaClass myClass) |
void |
addToSchemaType(TypeInfo ownerTypeInfo,
List<Property> properties,
org.eclipse.persistence.internal.oxm.schema.model.TypeDefParticle compositor,
org.eclipse.persistence.internal.oxm.schema.model.ComplexType type,
org.eclipse.persistence.internal.oxm.schema.model.Schema workingSchema) |
protected boolean |
areEquals(JavaClass src,
Class tgt)
Compares a JavaModel JavaClass to a Class.
|
protected boolean |
areEquals(JavaClass src,
String tgtCanonicalName)
Compares a JavaModel JavaClass to a Class.
|
protected org.eclipse.persistence.jaxb.compiler.SchemaGenerator.AddToSchemaResult |
buildSchemaComponentsForXPath(org.eclipse.persistence.internal.oxm.XPathFragment frag,
org.eclipse.persistence.jaxb.compiler.SchemaGenerator.AddToSchemaResult xpr,
boolean isChoice,
Property next)
This method will build element/complexType/typedefparticle components for a given xml-path,
and return an XmlPathResult instance containg the sequence that the target should be added
to, as well as the current schema - which could be different than the working schema used
before calling this method in the case of a prefixed path element from a different namespace.
|
org.eclipse.persistence.internal.oxm.schema.model.Attribute |
createGlobalAttribute(org.eclipse.persistence.internal.oxm.XPathFragment frag,
org.eclipse.persistence.internal.oxm.schema.model.Schema workingSchema,
org.eclipse.persistence.internal.oxm.schema.model.Schema fragSchema,
Property prop)
Create a global attribute.
|
org.eclipse.persistence.internal.oxm.schema.model.Element |
createGlobalElement(org.eclipse.persistence.internal.oxm.XPathFragment frag,
org.eclipse.persistence.internal.oxm.schema.model.Schema workingSchema,
org.eclipse.persistence.internal.oxm.schema.model.Schema fragSchema,
boolean isChoice,
boolean isUnbounded,
Property prop,
boolean shouldSetType)
Create a global element.
|
org.eclipse.persistence.internal.oxm.schema.model.Attribute |
createRefAttribute(String attributeRefName,
org.eclipse.persistence.internal.oxm.schema.model.ComplexType owningComplexType)
Create an attribute reference and add it to a given complex type.
|
org.eclipse.persistence.internal.oxm.schema.model.Element |
createRefElement(String elementRefName,
org.eclipse.persistence.internal.oxm.schema.model.TypeDefParticle particle)
Create an element reference and add it to a given particle.
|
protected org.eclipse.persistence.internal.oxm.schema.model.Element |
elementExistsInParticle(String elementName,
String refString,
org.eclipse.persistence.internal.oxm.schema.model.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,
jakarta.xml.bind.SchemaOutputResolver outputResolver) |
Collection<org.eclipse.persistence.internal.oxm.schema.model.Schema> |
getAllSchemas() |
ArrayList<Object> |
getEnumerationFacetsFor(EnumTypeInfo info) |
NamespaceInfo |
getNamespaceInfoForNamespace(String namespace) |
NamespaceInfo |
getNamespaceInfoForNamespace(String namespace,
String packageName) |
String |
getOrGeneratePrefixForNamespace(String URI,
org.eclipse.persistence.internal.oxm.schema.model.Schema schema)
Attempt to resolve the given URI to a prefix.
|
String |
getPrefixForNamespace(org.eclipse.persistence.internal.oxm.schema.model.Schema schema,
String URI) |
QName |
getSchemaTypeFor(JavaClass javaClass)
Return the schema type (as QName) based on a given JavaClass.
|
Map<String,SchemaTypeInfo> |
getSchemaTypeInfo()
Return the Map of SchemaTypeInfo instances.
|
String |
getSchemaTypeNameForClassName(String className) |
protected TransformerPropertyBuilder |
getTransformerPropertyBuilder(Property property,
TypeInfo typeInfo)
Returns TransformerPropertyBuilder which builds properties from xml transformers.
|
Property |
getXmlValueFieldForSimpleContent(TypeInfo info) |
boolean |
isCollectionType(Property field)
Indicates if a given Property is a collection type.
|
void |
populateSchemaTypes() |
public SchemaGenerator(Helper helper)
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, jakarta.xml.bind.SchemaOutputResolver outputResolver)
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)
public void addSchemaComponents(JavaClass myClass)
public void addToSchemaType(TypeInfo ownerTypeInfo, List<Property> properties, org.eclipse.persistence.internal.oxm.schema.model.TypeDefParticle compositor, org.eclipse.persistence.internal.oxm.schema.model.ComplexType type, org.eclipse.persistence.internal.oxm.schema.model.Schema workingSchema)
public QName getSchemaTypeFor(JavaClass javaClass)
javaClass
- public void populateSchemaTypes()
public ArrayList<Object> getEnumerationFacetsFor(EnumTypeInfo info)
public boolean isCollectionType(Property field)
field
- public Collection<org.eclipse.persistence.internal.oxm.schema.model.Schema> getAllSchemas()
public NamespaceInfo getNamespaceInfoForNamespace(String namespace)
public NamespaceInfo getNamespaceInfoForNamespace(String namespace, String packageName)
public String getPrefixForNamespace(org.eclipse.persistence.internal.oxm.schema.model.Schema schema, String URI)
public String getOrGeneratePrefixForNamespace(String URI, org.eclipse.persistence.internal.oxm.schema.model.Schema schema)
URI
- schema
- public void addGlobalElements(Map<QName,ElementDeclaration> additionalElements)
public Map<String,SchemaTypeInfo> getSchemaTypeInfo()
protected boolean areEquals(JavaClass src, String tgtCanonicalName)
src
- tgtCanonicalName
- protected boolean areEquals(JavaClass src, Class tgt)
src
- tgt
- protected org.eclipse.persistence.jaxb.compiler.SchemaGenerator.AddToSchemaResult buildSchemaComponentsForXPath(org.eclipse.persistence.internal.oxm.XPathFragment frag, org.eclipse.persistence.jaxb.compiler.SchemaGenerator.AddToSchemaResult xpr, boolean isChoice, Property next)
frag
- xpr
- isChoice
- next
- protected org.eclipse.persistence.internal.oxm.schema.model.Element elementExistsInParticle(String elementName, String refString, org.eclipse.persistence.internal.oxm.schema.model.TypeDefParticle particle)
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 elementpublic org.eclipse.persistence.internal.oxm.schema.model.Attribute createGlobalAttribute(org.eclipse.persistence.internal.oxm.XPathFragment frag, org.eclipse.persistence.internal.oxm.schema.model.Schema workingSchema, org.eclipse.persistence.internal.oxm.schema.model.Schema fragSchema, Property prop)
frag
- workingSchema
- fragSchema
- prop
- public org.eclipse.persistence.internal.oxm.schema.model.Element createGlobalElement(org.eclipse.persistence.internal.oxm.XPathFragment frag, org.eclipse.persistence.internal.oxm.schema.model.Schema workingSchema, org.eclipse.persistence.internal.oxm.schema.model.Schema fragSchema, boolean isChoice, boolean isUnbounded, Property prop, boolean shouldSetType)
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 typepublic org.eclipse.persistence.internal.oxm.schema.model.Element createRefElement(String elementRefName, org.eclipse.persistence.internal.oxm.schema.model.TypeDefParticle particle)
elementRefName
- particle
- public org.eclipse.persistence.internal.oxm.schema.model.Attribute createRefAttribute(String attributeRefName, org.eclipse.persistence.internal.oxm.schema.model.ComplexType owningComplexType)
attributeRefName
- owningComplexType
- protected TransformerPropertyBuilder getTransformerPropertyBuilder(Property property, TypeInfo typeInfo)
property
- property holding xml transformerstypeInfo
- typeInfo with transformer classCopyright © 2007–2020 Eclipse.org - EclipseLink Project. All rights reserved.