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(HashMap<QName,ElementDeclaration> additionalElements) |
void |
addSchemaComponents(JavaClass myClass) |
void |
addToSchemaType(TypeInfo ownerTypeInfo,
List<Property> properties,
TypeDefParticle compositor,
ComplexType type,
Schema workingSchema) |
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.
|
Schema |
generateSchema(ArrayList<JavaClass> typeInfoClasses,
HashMap<String,TypeInfo> typeInfo,
HashMap<String,QName> userDefinedSchemaTypes,
HashMap<String,PackageInfo> packageToPackageInfoMappings,
HashMap<QName,ElementDeclaration> additionalGlobalElements,
Map<String,Class> arrayClassesToGeneratedClasses) |
Schema |
generateSchema(ArrayList<JavaClass> typeInfoClasses,
HashMap<String,TypeInfo> typeInfo,
HashMap<String,QName> userDefinedSchemaTypes,
HashMap<String,PackageInfo> packageToPackageInfoMappings,
HashMap<QName,ElementDeclaration> additionalGlobalElements,
Map<String,Class> arrayClassesToGeneratedClasses,
SchemaOutputResolver outputResolver) |
Collection<Schema> |
getAllSchemas() |
ArrayList<Object> |
getEnumerationFacetsFor(EnumTypeInfo info) |
NamespaceInfo |
getNamespaceInfoForNamespace(String namespace) |
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.
|
HashMap<String,SchemaTypeInfo> |
getSchemaTypeInfo()
Return the Map of SchemaTypeInfo instances.
|
String |
getSchemaTypeNameForClassName(String className) |
Property |
getXmlValueFieldForSimpleContent(TypeInfo info) |
boolean |
isCollectionType(Property field)
Indicates if a given Property is a collection type.
|
void |
populateSchemaTypes() |
public SchemaGenerator(Helper helper)
public Schema generateSchema(ArrayList<JavaClass> typeInfoClasses, HashMap<String,TypeInfo> typeInfo, HashMap<String,QName> userDefinedSchemaTypes, HashMap<String,PackageInfo> packageToPackageInfoMappings, HashMap<QName,ElementDeclaration> additionalGlobalElements, Map<String,Class> arrayClassesToGeneratedClasses, SchemaOutputResolver outputResolver)
public Schema generateSchema(ArrayList<JavaClass> typeInfoClasses, HashMap<String,TypeInfo> typeInfo, HashMap<String,QName> userDefinedSchemaTypes, HashMap<String,PackageInfo> packageToPackageInfoMappings, HashMap<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 String getOrGeneratePrefixForNamespace(String URI, Schema schema)
URI
- schema
- public void addGlobalElements(HashMap<QName,ElementDeclaration> additionalElements)
public HashMap<String,SchemaTypeInfo> getSchemaTypeInfo()
public Attribute createGlobalAttribute(XPathFragment frag, Schema workingSchema, Schema fragSchema, Property prop)
frag
- workingSchema
- fragSchema
- next
- 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 choicenext
- 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
- EclipseLink 2.5.2, "build v20140319-9ad6abd" API Reference