Package org.apache.axis.description
Class TypeDesc
- java.lang.Object
-
- org.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.- Author:
- Glen Daniels (gdaniels@apache.org)
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFieldDesc(FieldDesc field)
Add a new FieldDesc, keeping the convenience fields in sync.BeanPropertyDescriptor
getAnyContentDescriptor()
BeanPropertyDescriptor
getAnyDesc()
QName
getAttributeNameForField(java.lang.String fieldName)
Get the QName associated with this field, but only if it's marked as an attribute.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(QName qname)
Get the field name associated with this QName, but only if it's marked as an attribute.java.lang.String
getFieldNameForElement(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 FieldDescsFieldDesc[]
getFields(boolean searchParents)
java.util.Map
getPropertyDescriptorMap()
Get/Cache the property descriptor mapBeanPropertyDescriptor[]
getPropertyDescriptors()
Get/Cache the property descriptorsstatic TypeDesc
getTypeDescForClass(java.lang.Class cls)
Static function for centralizing access to type metadata for a given class.QName
getXmlType()
boolean
hasAttributes()
Do we have any FieldDescs marked as attributes?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(QName xmlType)
-
-
-
Constructor Detail
-
TypeDesc
public TypeDesc(java.lang.Class javaClass)
Creates a newTypeDesc
instance. The type desc can search the metadata of its type'sparent classes.- Parameters:
javaClass
- aClass
value
-
TypeDesc
public TypeDesc(java.lang.Class javaClass, boolean canSearchParents)
Creates a newTypeDesc
instance.- Parameters:
javaClass
- aClass
valuecanSearchParents
- whether the type desc can search the metadata of its type's parent classes.
-
-
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.- Parameters:
cls
- the Class we're registering metadata abouttd
- the TypeDesc containing the metadata
-
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 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 QName getElementNameForField(java.lang.String fieldName)
Get the QName associated with this field, but only if it's marked as an element.
-
getAttributeNameForField
public 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(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(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 QName getXmlType()
-
setXmlType
public void setXmlType(QName xmlType)
-
getPropertyDescriptors
public BeanPropertyDescriptor[] getPropertyDescriptors()
Get/Cache the property descriptors- Returns:
- PropertyDescriptor
-
getAnyContentDescriptor
public BeanPropertyDescriptor getAnyContentDescriptor()
-
getPropertyDescriptorMap
public java.util.Map getPropertyDescriptorMap()
Get/Cache the property descriptor map- Returns:
- Map with key=propertyName, value=descriptor
-
-