|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rakeshv.BaseObject
public class BaseObject
A sub-class of java.lang.Object that is
meant to be used as the base-class for all classes.
This class provides an over-ridden toString() method that
returns an XML representation of all the fields in a
class that have Java Bean style accessor methods.
Copyright 2004 Rakesh Vidyadharan
| Field Summary | |
|---|---|
static java.lang.String |
END_OF_LINE
The end of line characters to use to delimit lines. |
private static java.util.logging.Logger |
logger
A logger used to log errors. |
| Constructor Summary | |
|---|---|
BaseObject()
|
|
| Method Summary | |
|---|---|
protected void |
printCollection(java.util.Collection collection,
java.lang.StringBuffer buffer)
Append XML representations of each element stored in the Collection to the specified StringBuffer. |
private void |
printField(java.lang.reflect.Field field,
java.lang.StringBuffer buffer)
Fetch the value of the specified Field using its
accessor method (if it exists). |
protected void |
printMap(java.util.Map map,
java.lang.StringBuffer buffer)
Append an XML representation of the key-value
mappings stored in the specified Map to the specified
StringBuffer. |
java.lang.String |
toString()
Returns a string that presents an XML representation of the data encapsulated in this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final java.lang.String END_OF_LINE
| Constructor Detail |
|---|
public BaseObject()
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Object
private void printField(java.lang.reflect.Field field,
java.lang.StringBuffer buffer)
Field using its
accessor method (if it exists). Write the XML
representation of the data encapsulated in the field to the
specified StringBuffer.
field - The field whose XML representation is to be derived.buffer - The StringBuffer to which the field's XML
representation is to be written.
protected void printCollection(java.util.Collection collection,
java.lang.StringBuffer buffer)
Collection to the specified StringBuffer.
This method will be invoked recursively for elements that are
themselves collections.
printMap( Map, StringBuffer )
protected void printMap(java.util.Map map,
java.lang.StringBuffer buffer)
key-value
mappings stored in the specified Map to the specified
StringBuffer. This method invokes itself recursively
for values that are themselves maps.
map - The map whose XML representation is to be generated.buffer - The StringBuffer to which the XML representation is
to be appended.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||