Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.description
Class TypeDesc  view TypeDesc download TypeDesc.java

java.lang.Object
  extended byorg.apache.axis.description.TypeDesc
All Implemented Interfaces:
java.io.Serializable

public class TypeDesc
extends java.lang.Object
implements java.io.Serializable

A TypeDesc represents a Java<->XML data binding. It is essentially a collection of FieldDescs describing how to map each field in a Java class to XML.


Field Summary
private  boolean _hasAttributes
          Are there any fields which are serialized as attributes?
private  org.apache.axis.utils.BeanPropertyDescriptor anyDesc
          Indication if this type has support for xsd:any.
private  boolean canSearchParents
          Can this instance search for metadata in parents of the type it describes?
private static java.util.Map classMap
          A map of class -> TypeDesc
private  java.util.HashMap fieldElementMap
          A cache of FieldDescs by Element QName
private  java.util.HashMap fieldNameMap
          A cache of FieldDescs by name
private  FieldDesc[] fields
          The various fields in here
private  boolean hasSearchedParents
           
private  java.lang.Class javaClass
          The Java class for this type
private  boolean lookedForAny
          Have we already introspected for the special "any" property desc?
static java.lang.Class[] noClasses
           
static java.lang.Object[] noObjects
           
private  TypeDesc parentDesc
          My superclass TypeDesc
private  org.apache.axis.utils.BeanPropertyDescriptor[] propertyDescriptors
          Introspected property descriptors
private  java.util.Map propertyMap
          Map with key = property descriptor name, value = descriptor
private  javax.xml.namespace.QName xmlType
          The XML type QName for this type
 
Constructor Summary
TypeDesc(java.lang.Class javaClass)
          Creates a new TypeDesc instance.
TypeDesc(java.lang.Class javaClass, boolean canSearchParents)
          Creates a new TypeDesc instance.
 
Method Summary
 void addFieldDesc(FieldDesc field)
          Add a new FieldDesc, keeping the convenience fields in sync.
 org.apache.axis.utils.BeanPropertyDescriptor getAnyContentDescriptor()
           
 org.apache.axis.utils.BeanPropertyDescriptor getAnyDesc()
           
 javax.xml.namespace.QName getAttributeNameForField(java.lang.String fieldName)
          Get the QName associated with this field, but only if it's marked as an attribute.
 javax.xml.namespace.QName getElementNameForField(java.lang.String fieldName)
          Get the QName associated with this field, but only if it's marked as an element.
 FieldDesc getFieldByName(java.lang.String name)
          Get a FieldDesc by field name.
 java.lang.String getFieldNameForAttribute(javax.xml.namespace.QName qname)
          Get the field name associated with this QName, but only if it's marked as an attribute.
 java.lang.String getFieldNameForElement(javax.xml.namespace.QName qname, boolean ignoreNS)
          Get the field name associated with this QName, but only if it's marked as an element.
 FieldDesc[] getFields()
          Obtain the current array of FieldDescs
 FieldDesc[] getFields(boolean searchParents)
           
 java.util.Map getPropertyDescriptorMap()
          Get/Cache the property descriptor map
 org.apache.axis.utils.BeanPropertyDescriptor[] getPropertyDescriptors()
          Get/Cache the property descriptors
static TypeDesc getTypeDescForClass(java.lang.Class cls)
          Static function for centralizing access to type metadata for a given class.
 javax.xml.namespace.QName getXmlType()
           
 boolean hasAttributes()
          Do we have any FieldDescs marked as attributes?
private  void makePropertyDescriptors()
           
static void registerTypeDescForClass(java.lang.Class cls, TypeDesc td)
          Static function to explicitly register a type description for a given class.
 void setFields(FieldDesc[] newFields)
          Replace the array of FieldDescs, making sure we keep our convenience caches in sync.
 void setXmlType(javax.xml.namespace.QName xmlType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

noClasses

public static final java.lang.Class[] noClasses

noObjects

public static final java.lang.Object[] noObjects

classMap

private static java.util.Map classMap
A map of class -> TypeDesc


lookedForAny

private boolean lookedForAny
Have we already introspected for the special "any" property desc?


canSearchParents

private boolean canSearchParents
Can this instance search for metadata in parents of the type it describes?


hasSearchedParents

private boolean hasSearchedParents

parentDesc

private TypeDesc parentDesc
My superclass TypeDesc


javaClass

private java.lang.Class javaClass
The Java class for this type


xmlType

private javax.xml.namespace.QName xmlType
The XML type QName for this type


fields

private FieldDesc[] fields
The various fields in here


fieldNameMap

private java.util.HashMap fieldNameMap
A cache of FieldDescs by name


fieldElementMap

private java.util.HashMap fieldElementMap
A cache of FieldDescs by Element QName


_hasAttributes

private boolean _hasAttributes
Are there any fields which are serialized as attributes?


propertyDescriptors

private org.apache.axis.utils.BeanPropertyDescriptor[] propertyDescriptors
Introspected property descriptors


propertyMap

private java.util.Map propertyMap
Map with key = property descriptor name, value = descriptor


anyDesc

private org.apache.axis.utils.BeanPropertyDescriptor anyDesc
Indication if this type has support for xsd:any.

Constructor Detail

TypeDesc

public TypeDesc(java.lang.Class javaClass)
Creates a new TypeDesc instance. The type desc can search the metadata of its type'sparent classes.


TypeDesc

public TypeDesc(java.lang.Class javaClass,
                boolean canSearchParents)
Creates a new TypeDesc instance.

Method Detail

registerTypeDescForClass

public static void registerTypeDescForClass(java.lang.Class cls,
                                            TypeDesc td)
Static function to explicitly register a type description for a given class.


getTypeDescForClass

public static TypeDesc getTypeDescForClass(java.lang.Class cls)
Static function for centralizing access to type metadata for a given class. This checks for a static getTypeDesc() method on the class or _Helper class. Eventually we may extend this to provide for external metadata config (via files sitting in the classpath, etc).


getAnyDesc

public org.apache.axis.utils.BeanPropertyDescriptor getAnyDesc()

getFields

public FieldDesc[] getFields()
Obtain the current array of FieldDescs


getFields

public FieldDesc[] getFields(boolean searchParents)

setFields

public void setFields(FieldDesc[] newFields)
Replace the array of FieldDescs, making sure we keep our convenience caches in sync.


addFieldDesc

public void addFieldDesc(FieldDesc field)
Add a new FieldDesc, keeping the convenience fields in sync.


getElementNameForField

public javax.xml.namespace.QName getElementNameForField(java.lang.String fieldName)
Get the QName associated with this field, but only if it's marked as an element.


getAttributeNameForField

public javax.xml.namespace.QName getAttributeNameForField(java.lang.String fieldName)
Get the QName associated with this field, but only if it's marked as an attribute.


getFieldNameForElement

public java.lang.String getFieldNameForElement(javax.xml.namespace.QName qname,
                                               boolean ignoreNS)
Get the field name associated with this QName, but only if it's marked as an element. If the "ignoreNS" argument is true, just compare localNames.


getFieldNameForAttribute

public java.lang.String getFieldNameForAttribute(javax.xml.namespace.QName qname)
Get the field name associated with this QName, but only if it's marked as an attribute.


getFieldByName

public FieldDesc getFieldByName(java.lang.String name)
Get a FieldDesc by field name.


hasAttributes

public boolean hasAttributes()
Do we have any FieldDescs marked as attributes?


getXmlType

public javax.xml.namespace.QName getXmlType()

setXmlType

public void setXmlType(javax.xml.namespace.QName xmlType)

getPropertyDescriptors

public org.apache.axis.utils.BeanPropertyDescriptor[] getPropertyDescriptors()
Get/Cache the property descriptors


makePropertyDescriptors

private void makePropertyDescriptors()

getAnyContentDescriptor

public org.apache.axis.utils.BeanPropertyDescriptor getAnyContentDescriptor()

getPropertyDescriptorMap

public java.util.Map getPropertyDescriptorMap()
Get/Cache the property descriptor map