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,
               TypeDefParticle compositor,
               ComplexType type,
               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(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. | 
| Attribute | createGlobalAttribute(XPathFragment frag,
                     Schema workingSchema,
                     Schema fragSchema,
                     Property prop)Create a global attribute. | 
| Element | createGlobalElement(XPathFragment frag,
                   Schema workingSchema,
                   Schema fragSchema,
                   boolean isChoice,
                   boolean isUnbounded,
                   Property prop,
                   boolean shouldSetType)Create a global element. | 
| Attribute | createRefAttribute(String attributeRefName,
                  ComplexType owningComplexType)Create an attribute reference and add it to a given complex type. | 
| Element | 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,
              jakarta.xml.bind.SchemaOutputResolver outputResolver) | 
| Collection<Schema> | getAllSchemas() | 
| ArrayList<Object> | getEnumerationFacetsFor(EnumTypeInfo info) | 
| NamespaceInfo | getNamespaceInfoForNamespace(String namespace) | 
| NamespaceInfo | getNamespaceInfoForNamespace(String namespace,
                            String packageName) | 
| String | getOrGeneratePrefixForNamespace(String URI,
                               Schema schema)Attempt to resolve the given URI to a prefix. | 
| String | getPrefixForNamespace(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, TypeDefParticle compositor, ComplexType type, 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<Schema> getAllSchemas()
public NamespaceInfo getNamespaceInfoForNamespace(String namespace)
public NamespaceInfo getNamespaceInfoForNamespace(String namespace, String packageName)
public String getOrGeneratePrefixForNamespace(String URI, 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(XPathFragment frag, org.eclipse.persistence.jaxb.compiler.SchemaGenerator.AddToSchemaResult xpr, boolean isChoice, Property next)
frag - xpr - isChoice - next - protected Element elementExistsInParticle(String elementName, String refString, 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 Attribute createGlobalAttribute(XPathFragment frag, Schema workingSchema, Schema fragSchema, Property prop)
frag - workingSchema - fragSchema - prop - public Element createGlobalElement(XPathFragment frag, Schema workingSchema, 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 Element createRefElement(String elementRefName, TypeDefParticle particle)
elementRefName - particle - public Attribute createRefAttribute(String attributeRefName, ComplexType owningComplexType)
attributeRefName - owningComplexType - protected TransformerPropertyBuilder getTransformerPropertyBuilder(Property property, TypeInfo typeInfo)
property - property holding xml transformerstypeInfo - typeInfo with transformer classCopyright © 2007–2021 Eclipse.org - EclipseLink Project. All rights reserved.