Class BeanElement

All Implemented Interfaces:
Serializable, Cloneable, Branch, Element, Node

public class BeanElement extends DefaultElement

BeanElement uses a Java Bean to store its attributes.

Version:
$Revision: 1.15 $
See Also:
  • Field Details

    • DOCUMENT_FACTORY

      private static final DocumentFactory DOCUMENT_FACTORY
      The DocumentFactory instance used by default
    • bean

      private Object bean
      The JavaBean which defines my attributes
  • Constructor Details

    • BeanElement

      public BeanElement(String name, Object bean)
    • BeanElement

      public BeanElement(String name, Namespace namespace, Object bean)
    • BeanElement

      public BeanElement(QName qname, Object bean)
    • BeanElement

      public BeanElement(QName qname)
  • Method Details

    • getData

      public Object getData()
      DOCUMENT ME!
      Specified by:
      getData in interface Element
      Overrides:
      getData in class AbstractElement
      Returns:
      the JavaBean associated with this element
    • setData

      public void setData(Object data)
      Description copied from interface: Element
      Sets the data value of this element if this element supports data binding or calls Node.setText(java.lang.String)if it doesn't
      Specified by:
      setData in interface Element
      Overrides:
      setData in class AbstractElement
      Parameters:
      data - DOCUMENT ME!
    • attribute

      public BeanAttribute attribute(String name)
      Description copied from interface: Element
      Returns the attribute with the given name
      Specified by:
      attribute in interface Element
      Overrides:
      attribute in class DefaultElement
      Parameters:
      name - DOCUMENT ME!
      Returns:
      the attribute for the given local name in any namespace. If there are more than one attributes with the given local name in different namespaces then the first one is returned.
    • attribute

      public BeanAttribute attribute(QName qname)
      Description copied from interface: Element
      DOCUMENT ME!
      Specified by:
      attribute in interface Element
      Overrides:
      attribute in class DefaultElement
      Parameters:
      qname - is the fully qualified name
      Returns:
      the attribute for the given fully qualified name or null if it could not be found.
    • addAttribute

      public Element addAttribute(String name, String value)
      Description copied from interface: Element
      Adds the attribute value of the given local name. If an attribute already exists for the given name it will be replaced. Attributes with null values are silently ignored. If the value of the attribute is null then this method call will remove any attributes with the given name.
      Specified by:
      addAttribute in interface Element
      Overrides:
      addAttribute in class AbstractElement
      Parameters:
      name - is the name of the attribute whose value is to be added or updated
      value - is the attribute's value
      Returns:
      this Element instance.
    • addAttribute

      public Element addAttribute(QName qName, String value)
      Description copied from interface: Element
      Adds the attribute value of the given fully qualified name. If an attribute already exists for the given name it will be replaced. Attributes with null values are silently ignored. If the value of the attribute is null then this method call will remove any attributes with the given name.
      Specified by:
      addAttribute in interface Element
      Overrides:
      addAttribute in class AbstractElement
      Parameters:
      qName - is the fully qualified name of the attribute whose value is to be added or updated
      value - is the attribute's value
      Returns:
      this Element instance.
    • setAttributes

      public void setAttributes(List<Attribute> attributes)
      Description copied from interface: Element
      Sets the attributes that this element contains
      Specified by:
      setAttributes in interface Element
      Overrides:
      setAttributes in class DefaultElement
      Parameters:
      attributes - DOCUMENT ME!
    • setAttributes

      public void setAttributes(Attributes attributes, NamespaceStack namespaceStack, boolean noNamespaceAttributes)
      Description copied from class: AbstractElement
      This method provides a more optimal way of setting all the attributes on an Element particularly for use in SAXReader.
      Overrides:
      setAttributes in class AbstractElement
      Parameters:
      attributes - DOCUMENT ME!
      namespaceStack - DOCUMENT ME!
      noNamespaceAttributes - DOCUMENT ME!
    • getDocumentFactory

      protected DocumentFactory getDocumentFactory()
      Overrides:
      getDocumentFactory in class DefaultElement
    • getBeanAttributeList

      protected BeanAttributeList getBeanAttributeList()
    • createAttributeList

      protected List<Attribute> createAttributeList()
      A Factory Method pattern which lazily creates a List implementation used to store content
      Overrides:
      createAttributeList in class AbstractElement
      Returns:
      DOCUMENT ME!
    • createAttributeList

      protected List<Attribute> createAttributeList(int size)
      Description copied from class: AbstractElement
      A Factory Method pattern which creates a List implementation used to store attributes
      Overrides:
      createAttributeList in class AbstractElement
      Parameters:
      size - DOCUMENT ME!
      Returns:
      DOCUMENT ME!