org.eclipse.persistence.jaxb.compiler
Class SchemaGenerator

java.lang.Object
  extended by org.eclipse.persistence.jaxb.compiler.SchemaGenerator

public class SchemaGenerator
extends Object

INTERNAL:

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.

Since:
Oracle TopLink 11.1.1.0.0
Author:
mmacivor
See Also:
TypeInfo, AnnotationsProcessor, Generator

Constructor Summary
SchemaGenerator(Helper helper)
           
 
Method Summary
 void addGlobalElements(HashMap<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)
           
 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 next)
          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)
          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.
 org.eclipse.persistence.internal.oxm.schema.model.Schema generateSchema(ArrayList<JavaClass> typeInfoClasses, HashMap<String,TypeInfo> typeInfo, HashMap<String,QName> userDefinedSchemaTypes, HashMap<String,NamespaceInfo> packageToNamespaceMappings, HashMap<QName,ElementDeclaration> additionalGlobalElements, Map<String,Class> arrayClassesToGeneratedClasses)
           
 Collection<org.eclipse.persistence.internal.oxm.schema.model.Schema> getAllSchemas()
           
 ArrayList<String> getEnumerationFacetsFor(EnumTypeInfo info)
           
 NamespaceInfo getNamespaceInfoForNamespace(String namespace)
           
 String getOrGeneratePrefixForNamespace(String URI, org.eclipse.persistence.internal.oxm.schema.model.Schema schema)
          Attempt to resolve the given URI to a prefix.
 String getPrefixForNamespace(String URI, NamespaceResolver namespaceResolver)
           
 QName getSchemaTypeFor(JavaClass javaClass)
           
 HashMap<String,SchemaTypeInfo> getSchemaTypeInfo()
           
 String getSchemaTypeNameForClassName(String className)
           
 Property getXmlValueFieldForSimpleContent(TypeInfo info)
           
 boolean isCollectionType(Property field)
           
 void populateSchemaTypes()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaGenerator

public SchemaGenerator(Helper helper)
Method Detail

generateSchema

public org.eclipse.persistence.internal.oxm.schema.model.Schema generateSchema(ArrayList<JavaClass> typeInfoClasses,
                                                                               HashMap<String,TypeInfo> typeInfo,
                                                                               HashMap<String,QName> userDefinedSchemaTypes,
                                                                               HashMap<String,NamespaceInfo> packageToNamespaceMappings,
                                                                               HashMap<QName,ElementDeclaration> additionalGlobalElements,
                                                                               Map<String,Class> arrayClassesToGeneratedClasses)

addSchemaComponents

public void addSchemaComponents(JavaClass myClass)

addToSchemaType

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)

getSchemaTypeFor

public QName getSchemaTypeFor(JavaClass javaClass)

populateSchemaTypes

public void populateSchemaTypes()

getSchemaTypeNameForClassName

public String getSchemaTypeNameForClassName(String className)

getEnumerationFacetsFor

public ArrayList<String> getEnumerationFacetsFor(EnumTypeInfo info)

getXmlValueFieldForSimpleContent

public Property getXmlValueFieldForSimpleContent(TypeInfo info)

isCollectionType

public boolean isCollectionType(Property field)

getAllSchemas

public Collection<org.eclipse.persistence.internal.oxm.schema.model.Schema> getAllSchemas()

getNamespaceInfoForNamespace

public NamespaceInfo getNamespaceInfoForNamespace(String namespace)

getPrefixForNamespace

public String getPrefixForNamespace(String URI,
                                    NamespaceResolver namespaceResolver)

getOrGeneratePrefixForNamespace

public String getOrGeneratePrefixForNamespace(String URI,
                                              org.eclipse.persistence.internal.oxm.schema.model.Schema schema)
Attempt to resolve the given URI to a prefix. If this is unsuccessful, one will be generated and added to the resolver.

Parameters:
URI -
schema -
Returns:

addGlobalElements

public void addGlobalElements(HashMap<QName,ElementDeclaration> additionalElements)

getSchemaTypeInfo

public HashMap<String,SchemaTypeInfo> getSchemaTypeInfo()

createGlobalAttribute

public 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 next)
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.

Parameters:
frag -
workingSchema -
fragSchema -
next -
Returns:

createGlobalElement

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)
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 -
workingSchema -
fragSchema -
isChoice -
isUnbounded -
Returns:

createRefElement

public 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. This method will typically be called when processing an XPath and a prefixed path element is encountered that requires an element ref.

Parameters:
elementRefName -
particle -
Returns:

createRefAttribute

public 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. This method will typically be called when processing an XPath and a prefixed path element is encountered that requires an attribute ref.

Parameters:
attributeRefName -
owningComplexType -
Returns: