Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.syndication.feed.impl
Class ToStringBean  view ToStringBean download ToStringBean.java

java.lang.Object
  extended bycom.sun.syndication.feed.impl.ToStringBean
All Implemented Interfaces:
java.io.Serializable

public class ToStringBean
extends java.lang.Object
implements java.io.Serializable

Provides deep Bean toString support.

It works on all read/write properties, recursively. It support all primitive types, Strings, Collections, ToString objects and multi-dimensional arrays of any of them.


Field Summary
private  java.lang.Class _beanClass
           
private  java.lang.Object _obj
           
private static java.lang.Object[] NO_PARAMS
           
private static java.lang.ThreadLocal PREFIX_TL
           
 
Constructor Summary
protected ToStringBean(java.lang.Class beanClass)
          Default constructor.
  ToStringBean(java.lang.Class beanClass, java.lang.Object obj)
          Creates a ToStringBean to be used in a delegation pattern.
 
Method Summary
private  void printArrayProperty(java.lang.StringBuffer sb, java.lang.String prefix, java.lang.Object array)
           
private  void printProperty(java.lang.StringBuffer sb, java.lang.String prefix, java.lang.Object value)
           
 java.lang.String toString()
          Returns the String representation of the bean given in the constructor.
private  java.lang.String toString(java.lang.String prefix)
          Returns the String representation of the bean given in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREFIX_TL

private static final java.lang.ThreadLocal PREFIX_TL

NO_PARAMS

private static final java.lang.Object[] NO_PARAMS

_beanClass

private java.lang.Class _beanClass

_obj

private java.lang.Object _obj
Constructor Detail

ToStringBean

protected ToStringBean(java.lang.Class beanClass)
Default constructor.

To be used by classes extending ToStringBean only.


ToStringBean

public ToStringBean(java.lang.Class beanClass,
                    java.lang.Object obj)
Creates a ToStringBean to be used in a delegation pattern.

For example:

public class Foo implements ToString { public String toString(String prefix) { ToStringBean tsb = new ToStringBean(this); return tsb.toString(prefix); } public String toString() { return toString("Foo"); } }

Method Detail

toString

public java.lang.String toString()
Returns the String representation of the bean given in the constructor.

It uses the Class name as the prefix.


toString

private java.lang.String toString(java.lang.String prefix)
Returns the String representation of the bean given in the constructor.


printProperty

private void printProperty(java.lang.StringBuffer sb,
                           java.lang.String prefix,
                           java.lang.Object value)

printArrayProperty

private void printArrayProperty(java.lang.StringBuffer sb,
                                java.lang.String prefix,
                                java.lang.Object array)