net.sourceforge.ajaxtags.xml
Class AjaxXmlBuilder

java.lang.Object
  extended by net.sourceforge.ajaxtags.xml.BaseXmlBuilder<ValueItem>
      extended by net.sourceforge.ajaxtags.xml.AjaxValueListXmlBuilder
          extended by net.sourceforge.ajaxtags.xml.AjaxXmlBuilder

public final class AjaxXmlBuilder
extends AjaxValueListXmlBuilder

Helper class to build valid XML typically returned in a response to the client.


Nested Class Summary
static class AjaxXmlBuilder.AbstractCDataPropertyProvider<T>
          Template for CData property provider (all items should be added as CData).
static class AjaxXmlBuilder.AbstractPropertyProvider<T>
          Template for text property provider (all items should be added as text, not as CData).
static interface AjaxXmlBuilder.PropertyProvider<T>
          Interface for property provider.
static interface AjaxXmlBuilder.PropertyReader
          Interface for objects with name/value/cData properties.
 
Constructor Summary
AjaxXmlBuilder()
           
 
Method Summary
 AjaxXmlBuilder addItem(AjaxXmlBuilder.PropertyReader element)
          Add item to XML.
 AjaxXmlBuilder addItem(String name, String value)
          Add item to XML.
 AjaxXmlBuilder addItem(String name, String value, boolean asCData)
          Add item to XML.
 AjaxXmlBuilder addItemAsCData(String name, String value)
          Add item wrapped with inside a CDATA element.
 AjaxXmlBuilder addItems(Collection<? extends AjaxXmlBuilder.PropertyReader> collection)
          Add collection of items to XML.
<T> AjaxXmlBuilder
addItems(Collection<? extends T> collection, AjaxXmlBuilder.PropertyProvider<T> provider)
          Add collection of items to XML.
 
Methods inherited from class net.sourceforge.ajaxtags.xml.AjaxValueListXmlBuilder
addItem, addItem, getXMLString
 
Methods inherited from class net.sourceforge.ajaxtags.xml.BaseXmlBuilder
add, clear, get, getEncoding, getItems, getList, isEmpty, setEncoding, setList, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AjaxXmlBuilder

public AjaxXmlBuilder()
Method Detail

addItem

public AjaxXmlBuilder addItem(String name,
                              String value)
Add item to XML.

Parameters:
name - The name of the item
value - The value of the item
Returns:
the XML builder

addItemAsCData

public AjaxXmlBuilder addItemAsCData(String name,
                                     String value)
Add item wrapped with inside a CDATA element.

Parameters:
name - The name of the item
value - The value of the item
Returns:
the XML builder

addItem

public AjaxXmlBuilder addItem(String name,
                              String value,
                              boolean asCData)
Add item to XML.

Parameters:
name - The name of the item
value - The value of the item
asCData - add as CData
Returns:
the XML builder

addItems

public AjaxXmlBuilder addItems(Collection<? extends AjaxXmlBuilder.PropertyReader> collection)
Add collection of items to XML.

Parameters:
collection - collection of items
Returns:
the XML builder

addItem

public AjaxXmlBuilder addItem(AjaxXmlBuilder.PropertyReader element)
Add item to XML.

Parameters:
element - item
Returns:
the XML builder

addItems

public <T> AjaxXmlBuilder addItems(Collection<? extends T> collection,
                                   AjaxXmlBuilder.PropertyProvider<T> provider)
Add collection of items to XML.

Type Parameters:
T - class of items
Parameters:
collection - collection of items
provider - provider to access properties of items
Returns:
the XML builder


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