com.sun.syndication.feed.impl
public class ToStringBean extends Object implements Serializable
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 | |
|---|---|
| static Object[] | NO_PARAMS |
| static ThreadLocal | PREFIX_TL |
| Class | _beanClass |
| Object | _obj |
| Constructor Summary | |
|---|---|
| protected | ToStringBean(Class beanClass)
Default constructor.
|
| ToStringBean(Class beanClass, Object obj)
Creates a ToStringBean to be used in a delegation pattern.
| |
| Method Summary | |
|---|---|
| void | printArrayProperty(StringBuffer sb, String prefix, Object array) |
| void | printProperty(StringBuffer sb, String prefix, Object value) |
| String | toString()
Returns the String representation of the bean given in the constructor.
|
| String | toString(String prefix)
Returns the String representation of the bean given in the constructor.
|
To be used by classes extending ToStringBean only.
Parameters: beanClass indicates the class to scan for properties, normally an interface class.
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");
}
}
Parameters: beanClass indicates the class to scan for properties, normally an interface class. obj object bean to create String representation.
It uses the Class name as the prefix.
Returns: bean object String representation.
Parameters: prefix to use for bean properties.
Returns: bean object String representation.