JSX
Class P

java.lang.Object
  extended by JSX.P

public class P
extends java.lang.Object

These convenience methods simply wrap the calls to JSX. Exceptions are printed, and not passed up.


Method Summary
static java.lang.String asString(java.lang.Object obj)
          Returns the XML of the object graph as a string.
static java.lang.Object fromFile(java.lang.String filename)
          Reads the XML from the named file, and returns its object graph.
static java.lang.Object fromString(java.lang.String str)
          Returns the object graph of the XML in the string.
static void p(java.lang.Object obj)
          This static convenience method is helpful for debugging, by revealing the internals of object graphs: their classes, superclasses, fields (inherited and hidden) and cyclic references.
static void p(java.io.OutputStream out, java.lang.Object obj)
           
static void p(java.io.Writer out, java.lang.Object obj)
           
static void toFile(java.lang.String filename, java.lang.Object obj)
          Writes the XML of the object graph to the named file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

p

public static void p(java.lang.Object obj)
This static convenience method is helpful for debugging, by revealing the internals of object graphs: their classes, superclasses, fields (inherited and hidden) and cyclic references.

In the format, an <object> contains a <declaredClass> for the object's class, and one for each of its superclasses. Each <declaredClass> has a <default>, which contains the object's fields. The format is specified here, in XML Schema: jsx.xsd


p

public static void p(java.io.OutputStream out,
                     java.lang.Object obj)

p

public static void p(java.io.Writer out,
                     java.lang.Object obj)

asString

public static java.lang.String asString(java.lang.Object obj)
Returns the XML of the object graph as a string. One use of this is in unit testing, where the XML of the expected and actual object graph can be compared. WARNING: this is not suitable for sets or maps, because their ordering can change, and if it does, then their XML is no longer equal, even though the values are equal.


fromString

public static java.lang.Object fromString(java.lang.String str)
Returns the object graph of the XML in the string.


toFile

public static void toFile(java.lang.String filename,
                          java.lang.Object obj)
Writes the XML of the object graph to the named file.


fromFile

public static java.lang.Object fromFile(java.lang.String filename)
Reads the XML from the named file, and returns its object graph.