|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttester.Printer
public class Printer
| Field Summary | |
|---|---|
private static int |
counter
object counter |
private static java.util.HashMap<java.lang.Integer,java.lang.Integer> |
hashmap
a hashmap of the hashcodes for the objects that are being printed: if the same pair is compared again, the loop of printing stops and produces true |
private static java.lang.String |
INDENT
current indentation level for pretty-printing |
(package private) java.lang.Object |
obj
the object we wish to pretty-print |
private static java.lang.String |
result
the resulting string produced |
| Constructor Summary | |
|---|---|
Printer()
|
|
| Method Summary | |
|---|---|
private static java.lang.String |
makeIterableStrings(java.util.Iterator it)
Produce a String that represents the data generated
by the given iterator -- comma separated. |
private static java.lang.String |
makeString(java.lang.Object obj)
Produce a String representation of the given object. |
static void |
print(java.lang.Object obj)
Print the values of the given object |
static java.lang.String |
produceString(java.lang.Object obj)
Produce a String representation of the values of the given object |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
java.lang.Object obj
private static java.lang.String INDENT
private static java.lang.String result
private static int counter
private static java.util.HashMap<java.lang.Integer,java.lang.Integer> hashmap
| Constructor Detail |
|---|
public Printer()
| Method Detail |
|---|
public static void print(java.lang.Object obj)
obj - the object to display in the consolepublic static java.lang.String produceString(java.lang.Object obj)
obj - the object to represent
private static java.lang.String makeString(java.lang.Object obj)
Show String 'as is'.
For primitive datatypes and thier wrapper classes show the primitive values.
For all Arrays traverse over all elements.
For datatypes that implement Iterable interface
traverse over all elements.
For datatypes that implement
interface traverse over all elements.Traversal
For an instance of a declared class show all fields
obj - the given objectprivate static java.lang.String makeIterableStrings(java.util.Iterator it)
String that represents the data generated
by the given iterator -- comma separated.
it - the iterator for generating data
String that represents all generated data
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||