public abstract class DTO
extends java.lang.Object
A Data Transfer Object (DTO) is easily serializable having only public fields of primitive types and their wrapper classes, Strings, and DTOs. List, Set, Map and array aggregates may also be used. The aggregates must only hold objects of the listed types or aggregates.
The object graph from a Data Transfer Object must be a tree to simplify serialization and deserialization.
Constructor and Description |
---|
DTO() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.StringBuilder |
appendArray(java.lang.StringBuilder result,
java.util.Map<java.lang.Object,java.lang.String> objectRefs,
java.lang.String refpath,
java.lang.Object array)
Append the specified array's string representation to the specified
StringBuilder.
|
private static java.lang.StringBuilder |
appendDTO(java.lang.StringBuilder result,
java.util.Map<java.lang.Object,java.lang.String> objectRefs,
java.lang.String refpath,
DTO dto)
Append the specified DTO's string representation to the specified
StringBuilder.
|
private static java.lang.StringBuilder |
appendIterable(java.lang.StringBuilder result,
java.util.Map<java.lang.Object,java.lang.String> objectRefs,
java.lang.String refpath,
java.lang.Iterable<?> iterable)
Append the specified iterable's string representation to the specified
StringBuilder.
|
private static java.lang.StringBuilder |
appendMap(java.lang.StringBuilder result,
java.util.Map<java.lang.Object,java.lang.String> objectRefs,
java.lang.String refpath,
java.util.Map<?,?> map)
Append the specified map's string representation to the specified
StringBuilder.
|
private static java.lang.StringBuilder |
appendString(java.lang.StringBuilder result,
java.lang.CharSequence string)
Append the specified string to the specified StringBuilder.
|
private static java.lang.StringBuilder |
appendValue(java.lang.StringBuilder result,
java.util.Map<java.lang.Object,java.lang.String> objectRefs,
java.lang.String refpath,
java.lang.Object value)
Append the specified value's string representation to the specified
StringBuilder.
|
private static java.lang.CharSequence |
compress(java.lang.CharSequence in)
Compress, in length, the specified string.
|
java.lang.String |
toString()
Return a string representation of this DTO suitable for use when
debugging.
|
public java.lang.String toString()
The format of the string representation is not specified and subject to change.
toString
in class java.lang.Object
private static java.lang.StringBuilder appendDTO(java.lang.StringBuilder result, java.util.Map<java.lang.Object,java.lang.String> objectRefs, java.lang.String refpath, DTO dto)
result
- StringBuilder to which the string representation is
appended.objectRefs
- References to "seen" objects.refpath
- The reference path of the specified DTO.dto
- The DTO whose string representation is to be appended.private static java.lang.StringBuilder appendValue(java.lang.StringBuilder result, java.util.Map<java.lang.Object,java.lang.String> objectRefs, java.lang.String refpath, java.lang.Object value)
This method handles cycles in the object graph, using path-based references, even though the specification requires the object graph from a DTO to be a tree.
result
- StringBuilder to which the string representation is
appended.objectRefs
- References to "seen" objects.refpath
- The reference path of the specified value.value
- The object whose string representation is to be appended.private static java.lang.StringBuilder appendArray(java.lang.StringBuilder result, java.util.Map<java.lang.Object,java.lang.String> objectRefs, java.lang.String refpath, java.lang.Object array)
result
- StringBuilder to which the string representation is
appended.objectRefs
- References to "seen" objects.refpath
- The reference path of the specified array.array
- The array whose string representation is to be appended.private static java.lang.StringBuilder appendIterable(java.lang.StringBuilder result, java.util.Map<java.lang.Object,java.lang.String> objectRefs, java.lang.String refpath, java.lang.Iterable<?> iterable)
result
- StringBuilder to which the string representation is
appended.objectRefs
- References to "seen" objects.refpath
- The reference path of the specified list.iterable
- The iterable whose string representation is to be
appended.private static java.lang.StringBuilder appendMap(java.lang.StringBuilder result, java.util.Map<java.lang.Object,java.lang.String> objectRefs, java.lang.String refpath, java.util.Map<?,?> map)
result
- StringBuilder to which the string representation is
appended.objectRefs
- References to "seen" objects.refpath
- The reference path of the specified map.map
- The map whose string representation is to be appended.private static java.lang.StringBuilder appendString(java.lang.StringBuilder result, java.lang.CharSequence string)
result
- StringBuilder to which the string is appended.string
- The string to be appended.private static java.lang.CharSequence compress(java.lang.CharSequence in)
in
- The string to potentially compress.