net.sourceforge.ajaxtags.xml
Class BaseXmlBuilder<V>

java.lang.Object
  extended by net.sourceforge.ajaxtags.xml.BaseXmlBuilder<V>
Type Parameters:
V - type of list elements (Item, TreeItem)
Direct Known Subclasses:
AjaxTreeXmlBuilder, AjaxValueListXmlBuilder

public abstract class BaseXmlBuilder<V>
extends Object

Helper class to build valid XML as a base for all XML builders.


Constructor Summary
BaseXmlBuilder()
           
 
Method Summary
 BaseXmlBuilder<V> add(V item)
          Add item to list.
 void clear()
          Delete all items.
 V get(int index)
          Return the item at index.
 String getEncoding()
           
protected  List<V> getItems()
           
protected  List<V> getList()
           
protected abstract  String getXMLString()
           
 boolean isEmpty()
          Check if list contains no elements (is empty).
 void setEncoding(String encoding)
          Set the XML encoding.
protected  void setList(List<V> list)
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseXmlBuilder

public BaseXmlBuilder()
Method Detail

getList

protected List<V> getList()

setList

protected void setList(List<V> list)

getEncoding

public String getEncoding()
Returns:
the XML encoding

setEncoding

public void setEncoding(String encoding)
Set the XML encoding.

Parameters:
encoding - the XML encoding

getItems

protected List<V> getItems()
Returns:
the item list

getXMLString

protected abstract String getXMLString()
Returns:
the XML body, XML encoding is added by toString()

toString

public String toString()
Overrides:
toString in class Object
Returns:
the full XML document

add

public BaseXmlBuilder<V> add(V item)
Add item to list.

Parameters:
item - the item to add
Returns:
BaseXmlBuilder
See Also:
ArrayList.add(Object)

clear

public void clear()
Delete all items.


get

public V get(int index)
Return the item at index.

Parameters:
index - the index
Returns:
the item at index

isEmpty

public boolean isEmpty()
Check if list contains no elements (is empty).

Returns:
true if it is empty else false

size

public int size()
Returns:
the item count


Copyright © 2005-2010 The Ajaxtags Team. All Rights Reserved.