org.apache.axis.wsdl.fromJava
Class Types

java.lang.Object
  |
  +--org.apache.axis.wsdl.fromJava.Types

public class Types
extends java.lang.Object

Description:

This class is used to recursively serializes a Java Class into an XML Schema representation. It has utility methods to create a schema node, assosiate namespaces to the various types

Author:
unascribed

Constructor Summary
Types(javax.wsdl.Definition def, TypeMapping tm, TypeMapping defaultTM, Namespaces namespaces, java.lang.String targetNamespace, Java2WSDLFactory factory, java.util.List stopClasses)
          This class serailizes a Class to XML Schema.
 
Method Summary
 org.w3c.dom.Element createAttributeElement(java.lang.String elementName, java.lang.String elementType, boolean nullable, org.w3c.dom.Document docHolder)
          Create Attribute Element with a given name and type
 org.w3c.dom.Element createElement(java.lang.String elementName)
          Create a DOM Element in this context
 org.w3c.dom.Element createElement(java.lang.String elementName, java.lang.String elementType, boolean nullable, org.w3c.dom.Document docHolder)
          Create Element with a given name and type
 BuilderBeanClassRep getBeanBuilder()
          Return the class rep that allows users to build their own beans
static java.lang.String getLocalNameFromFullName(java.lang.String full)
          Utility method to get the local class name from a fully qualified java class name
static java.lang.String getPackageNameFromFullName(java.lang.String full)
          Utility method to get the package name from a fully qualified java class name
 java.util.List getStopClasses()
          Return the list of classes that we should not emit WSDL for.
 javax.wsdl.QName getWsdlQName(QName qName)
          convert from JAX-RPC QName to WSDL QName
 void insertTypesFragment(org.w3c.dom.Document doc)
          Inserts the type fragment into the given wsdl document
static boolean isEnumClass(java.lang.Class cls)
          Returns true if indicated type matches the JAX-RPC enumeration class.
 boolean isNullable(java.lang.Class type)
          Determines if the field is nullable.
 boolean isSimpleSchemaType(java.lang.Class type)
          Is the given class one of the simple types defined by Schema (per JSR 101 v.0.6)
 javax.wsdl.QName writePartType(java.lang.Class type)
          Serialize the Class as XML schema to the document.
 void writeSchemaElement(javax.wsdl.QName qName, org.w3c.dom.Element element)
          Write out the given Element into the appropriate schema node.
 java.lang.String writeType(java.lang.Class type)
          Write a schema representation for the given Class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Types

public Types(javax.wsdl.Definition def,
             TypeMapping tm,
             TypeMapping defaultTM,
             Namespaces namespaces,
             java.lang.String targetNamespace,
             Java2WSDLFactory factory,
             java.util.List stopClasses)
This class serailizes a Class to XML Schema. The constructor provides the context for the streamed node within the WSDL document
Parameters:
def - WSDL Definition Element to declare namespaces
tm - TypeMappingRegistry to handle known types
defaultTM - default TM
namespaces - user defined or autogenerated namespace and prefix maps
targetNamespace - targetNamespace of the document
factory - Java2WSDLFactory
Method Detail

writePartType

public javax.wsdl.QName writePartType(java.lang.Class type)
                               throws java.lang.Exception
Serialize the Class as XML schema to the document. Create a types node for the WSDL if one doesn't exist Create a schema node for the Class namespace, if one doesn't exist In case of a primitive type, no need to stream out anything, just return the QName of the primitive type
Parameters:
type - Class to generate the XML Schema info for
Returns:
the QName of the generated Schema type, null if void

getPackageNameFromFullName

public static java.lang.String getPackageNameFromFullName(java.lang.String full)
Utility method to get the package name from a fully qualified java class name
Parameters:
full - input class name
Returns:
package name

getLocalNameFromFullName

public static java.lang.String getLocalNameFromFullName(java.lang.String full)
Utility method to get the local class name from a fully qualified java class name
Parameters:
full - input class name
Returns:
package name

writeSchemaElement

public void writeSchemaElement(javax.wsdl.QName qName,
                               org.w3c.dom.Element element)
Write out the given Element into the appropriate schema node. If need be create the schema node as well
Parameters:
qName - qName to get the namespace of the schema node
element - the Element to append to the Schema node

writeType

public java.lang.String writeType(java.lang.Class type)
                           throws java.lang.Exception
Write a schema representation for the given Class. Recurse through all the public fields as well as fields represented by java bean compliant accessor methods. Then return the qualified string representation of the generated type
Parameters:
type - Class for which to generate schema
Returns:
a prefixed string for the schema type
Throws:
java.lang.Exception -  

isEnumClass

public static boolean isEnumClass(java.lang.Class cls)
Returns true if indicated type matches the JAX-RPC enumeration class. Note: supports JSR 101 version 0.6 Public Draft

createElement

public org.w3c.dom.Element createElement(java.lang.String elementName,
                                         java.lang.String elementType,
                                         boolean nullable,
                                         org.w3c.dom.Document docHolder)
Create Element with a given name and type
Parameters:
elementName - the name of the created element
elementType - schema type representation of the element
nullable - nullable attribute of the element
Returns:
the created Element

createAttributeElement

public org.w3c.dom.Element createAttributeElement(java.lang.String elementName,
                                                  java.lang.String elementType,
                                                  boolean nullable,
                                                  org.w3c.dom.Document docHolder)
Create Attribute Element with a given name and type
Parameters:
elementName - the name of the created element
elementType - schema type representation of the element
nullable - nullable attribute of the element
Returns:
the created Element

getWsdlQName

public javax.wsdl.QName getWsdlQName(QName qName)
convert from JAX-RPC QName to WSDL QName
Parameters:
qName - JAX-RPC QName
Returns:
WSDL QName

isSimpleSchemaType

public boolean isSimpleSchemaType(java.lang.Class type)
Is the given class one of the simple types defined by Schema (per JSR 101 v.0.6)
Parameters:
type - input Class
Returns:
true if the type is a simple schema type

isNullable

public boolean isNullable(java.lang.Class type)
Determines if the field is nullable. All non-primitives except for byte[] are nillable.
Parameters:
type - input Class
Returns:
true if nullable

insertTypesFragment

public void insertTypesFragment(org.w3c.dom.Document doc)
Inserts the type fragment into the given wsdl document
Parameters:
doc -  

getStopClasses

public java.util.List getStopClasses()
Return the list of classes that we should not emit WSDL for.

getBeanBuilder

public BuilderBeanClassRep getBeanBuilder()
Return the class rep that allows users to build their own beans

createElement

public org.w3c.dom.Element createElement(java.lang.String elementName)
Create a DOM Element in this context


Copyright © 2001 Apache XML Project. All Rights Reserved.