Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.util
Class XMLEncoder

    java.lang.Object
      org.apache.cayenne.util.XMLEncoder

    public class XMLEncoder

extends java.lang.Object

A helper class to encode objects to XML.

Since:
  1.1

Field Summary
`protected java.lang.String` | `indent`
`protected boolean` | `indentLine`
`protected int` | `indentTimes`
`protected java.io.PrintWriter` | `out`
`protected java.lang.String` | `projectVersion`

Constructor Summary
`XMLEncoder(java.io.PrintWriter out)`
`XMLEncoder(java.io.PrintWriter out, java.lang.String indent)`
`XMLEncoder(java.io.PrintWriter out, java.lang.String indent, java.lang.String projectVersion)`

Method Summary
`java.io.PrintWriter` | `getPrintWriter()`
`void` | `indent(int i)`
`void` | `print(boolean b)`
`void` | `print(char c)`
`void` | `print(java.util.Collection<? extends XMLSerializable> c)` Utility method that prints all map values, assuming they are XMLSerializable objects.
`void` | `print(int i)`
`void` | `print(java.util.Map<?,? extends XMLSerializable> map)` Utility method that prints all map values, assuming they are XMLSerializable objects.
`void` | `print(java.lang.String text)`
`void` | `printAttribute(java.lang.String name, java.lang.String value)` Prints an XML attribute.
`void` | `println()`
`void` | `println(char c)`
`void` | `println(java.lang.String text)`
`void` | `printlnAttribute(java.lang.String name, java.lang.String value)`
`void` | `printProjectVersion()` Inserts an optional project version attribute in the output.
`void` | `printProperty(java.lang.String name, boolean b)` Prints a common XML element - property with name and value.
`void` | `printProperty(java.lang.String name, int i)` Prints a common XML element - property with name and value.
`void` | `printProperty(java.lang.String name, java.lang.String value)` Prints a common XML element - property with name and value.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### projectVersion

    protected java.lang.String projectVersion

### indent

    protected java.lang.String indent

### out

    protected java.io.PrintWriter out

### indentLine

    protected boolean indentLine

### indentTimes

    protected int indentTimes

Constructor Detail

### XMLEncoder

    public XMLEncoder(java.io.PrintWriter out)

### XMLEncoder

    public XMLEncoder(java.io.PrintWriter out,
                      java.lang.String indent)

### XMLEncoder

    public XMLEncoder(java.io.PrintWriter out,
                      java.lang.String indent,
                      java.lang.String projectVersion)

Since:
  3.1

Method Detail

### getPrintWriter

    public java.io.PrintWriter getPrintWriter()

### indent

    public void indent(int i)

### print

    public void print(java.util.Map<?,? extends XMLSerializable> map)

  Utility method that prints all map values, assuming they are XMLSerializable objects.

### print

    public void print(java.util.Collection<? extends XMLSerializable> c)

  Utility method that prints all map values, assuming they are XMLSerializable objects.

### printProjectVersion

    public void printProjectVersion()

  Inserts an optional project version attribute in the output. If the project version is not initialized for encoder, will do nothing.

  Since:
    3.1

### printAttribute

    public void printAttribute(java.lang.String name,
                               java.lang.String value)

  Prints an XML attribute. The value is trimmed (so leading and following spaces are lost) and then encoded to be a proper XML attribute value. E.g. "&" becomes "&", etc.

  Since:
    3.1

### printlnAttribute

    public void printlnAttribute(java.lang.String name,
                                 java.lang.String value)

  Since:
    3.1

### printProperty

    public void printProperty(java.lang.String name,
                              java.lang.String value)

  Prints a common XML element - property with name and value.

### printProperty

    public void printProperty(java.lang.String name,
                              boolean b)

  Prints a common XML element - property with name and value.

### printProperty

    public void printProperty(java.lang.String name,
                              int i)

  Prints a common XML element - property with name and value.

### print

    public void print(java.lang.String text)

### print

    public void print(char c)

### print

    public void print(boolean b)

### print

    public void print(int i)

### println

    public void println(java.lang.String text)

### println

    public void println()

  Since:
    3.1

### println

    public void println(char c)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.