public class

XMLBeanInfo

extends Object
java.lang.Object
   ↳ org.apache.commons.betwixt.XMLBeanInfo

Class Overview

XMLBeanInfo represents the XML metadata information used to map a Java Bean cleanly to XML. This provides a default introspection mechansim, rather like java.beans.BeanInfo which can be customized through some mechansim, either via Java code or XSLT for example.

ID and IDREF Attribute Names

These special attributes are defined in the xml specification. They are used by Betwixt to write bean graphs with cyclic references. In most cases, these will take the values 'id' and 'idref' respectively but these names can be varied in the DTD. Therefore, these names are specified by this class but default to the usual values.

Summary

Public Constructors
XMLBeanInfo(Class beanClass)
Base constructor
Public Methods
Class getBeanClass()
Gets the beans class that this XML info refers to
ElementDescriptor getElementDescriptor()
Gets descriptor for bean represention
AttributeDescriptor getIDAttribute()
Search attributes for one matching ID attribute name
String getIDAttributeName()

Get name of ID attribute.

String getIDREFAttributeName()

Get IDREF attribute name This is used (for example) to deal with cyclic references.

void setBeanClass(Class beanClass)
Sets the beans class that this XML info refers to
void setElementDescriptor(ElementDescriptor elementDescriptor)
Sets descriptor for bean represention
void setIDAttributeName(String idAttributeName)
Set name of ID attribute This is used to write (for example) automatic ID attribute values.
void setIDREFAttributeName(String idrefAttributeName)
Set IDREF attribute name This is used (for example) to deal with cyclic references.
String toString()
Gets log-friendly string representation.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public XMLBeanInfo (Class beanClass)

Base constructor

Parameters
beanClass for this Class

Public Methods

public Class getBeanClass ()

Gets the beans class that this XML info refers to

Returns
  • the beans class that this XML info refers to

public ElementDescriptor getElementDescriptor ()

Gets descriptor for bean represention

Returns
  • ElementDescriptor describing root element

public AttributeDescriptor getIDAttribute ()

Search attributes for one matching ID attribute name

Returns
  • the xml ID attribute

public String getIDAttributeName ()

Get name of ID attribute. This is used to write (for example) automatic ID attribute values.

The default name is 'id'.

Returns
  • name for the special ID attribute

public String getIDREFAttributeName ()

Get IDREF attribute name This is used (for example) to deal with cyclic references.

The default name is 'idref'.

Returns
  • name for the special IDREF attribute

public void setBeanClass (Class beanClass)

Sets the beans class that this XML info refers to

Parameters
beanClass the class that this refers to

public void setElementDescriptor (ElementDescriptor elementDescriptor)

Sets descriptor for bean represention

Parameters
elementDescriptor descriptor for bean

public void setIDAttributeName (String idAttributeName)

Set name of ID attribute This is used to write (for example) automatic ID attribute values.

The default name is 'id'.

Parameters
idAttributeName the attribute name for the special ID attribute

public void setIDREFAttributeName (String idrefAttributeName)

Set IDREF attribute name This is used (for example) to deal with cyclic references.

The default name is 'idref'.

Parameters
idrefAttributeName the attribute name for the special IDREF attribute

public String toString ()

Gets log-friendly string representation.

Returns
  • something useful for logging