org.apache.axis.description

Class TypeDesc

public class TypeDesc extends Object implements 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.

Author: Glen Daniels (gdaniels@apache.org)

Field Summary
static Class[]noClasses
static Object[]noObjects
Constructor Summary
TypeDesc(Class javaClass)
Creates a new TypeDesc instance.
TypeDesc(Class javaClass, boolean canSearchParents)
Creates a new TypeDesc instance.
Method Summary
voidaddFieldDesc(FieldDesc field)
Add a new FieldDesc, keeping the convenience fields in sync.
BeanPropertyDescriptorgetAnyContentDescriptor()
BeanPropertyDescriptorgetAnyDesc()
QNamegetAttributeNameForField(String fieldName)
Get the QName associated with this field, but only if it's marked as an attribute.
QNamegetElementNameForField(String fieldName)
Get the QName associated with this field, but only if it's marked as an element.
FieldDescgetFieldByName(String name)
Get a FieldDesc by field name.
StringgetFieldNameForAttribute(QName qname)
Get the field name associated with this QName, but only if it's marked as an attribute.
StringgetFieldNameForElement(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)
MapgetPropertyDescriptorMap()
Get/Cache the property descriptor map
BeanPropertyDescriptor[]getPropertyDescriptors()
Get/Cache the property descriptors
static TypeDescgetTypeDescForClass(Class cls)
Static function for centralizing access to type metadata for a given class.
QNamegetXmlType()
booleanhasAttributes()
Do we have any FieldDescs marked as attributes?
static voidregisterTypeDescForClass(Class cls, TypeDesc td)
Static function to explicitly register a type description for a given class.
voidsetFields(FieldDesc[] newFields)
Replace the array of FieldDescs, making sure we keep our convenience caches in sync.
voidsetXmlType(QName xmlType)

Field Detail

noClasses

public static final Class[] noClasses

noObjects

public static final Object[] noObjects

Constructor Detail

TypeDesc

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

Parameters: javaClass a Class value

TypeDesc

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

Parameters: javaClass a Class value canSearchParents whether the type desc can search the metadata of its type's parent classes.

Method Detail

addFieldDesc

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

getAnyContentDescriptor

public BeanPropertyDescriptor getAnyContentDescriptor()

getAnyDesc

public BeanPropertyDescriptor getAnyDesc()

getAttributeNameForField

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

getElementNameForField

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

getFieldByName

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

getFieldNameForAttribute

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

getFieldNameForElement

public String getFieldNameForElement(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.

getFields

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

getFields

public FieldDesc[] getFields(boolean searchParents)

getPropertyDescriptorMap

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

Returns: Map with key=propertyName, value=descriptor

getPropertyDescriptors

public BeanPropertyDescriptor[] getPropertyDescriptors()
Get/Cache the property descriptors

Returns: PropertyDescriptor

getTypeDescForClass

public static TypeDesc getTypeDescForClass(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).

getXmlType

public QName getXmlType()

hasAttributes

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

registerTypeDescForClass

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

Parameters: cls the Class we're registering metadata about td the TypeDesc containing the metadata

setFields

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

setXmlType

public void setXmlType(QName xmlType)
Copyright B) 2005 Apache Web Services Project. All Rights Reserved.