Package io.permazen.core.util
Class ObjDumper
java.lang.Object
io.permazen.core.util.ObjDumper
Utility classes for printing database objects and fields in a human-readable format.
To use this class for implementing Object.toString()
, add a method like this to your Java model classes:
@Override public String toString() { return ObjDumper.toString(this.getTransaction().getTransaction(), this.getObjId(), 16); }
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
print
(PrintWriter writer, Transaction tx, ObjId id, int maxCollectionEntries) Print the content of the given object's fields in a human readable format.static String
toString
(Transaction tx, ObjId id, int maxCollectionEntries) Helper for Java model objectObject.toString()
methods that wish to display all fields in the object.
-
Method Details
-
toString
Helper for Java model objectObject.toString()
methods that wish to display all fields in the object.- Parameters:
tx
- transaction containing the objectid
- the ID of the objectmaxCollectionEntries
- maximum number of elements to display in any collection field or -1 to not display any fields- Returns:
- contents of the specified object, or just object type and ID if
tx
is no longer valid - Throws:
IllegalArgumentException
- iftx
orid
is null
-
print
Print the content of the given object's fields in a human readable format.The given transaction must still be open and the specified object must exist therein.
- Parameters:
writer
- output destinationtx
- transaction containing the objectid
- the ID of the objectmaxCollectionEntries
- maximum number of elements to display in any collection field or -1 to not display any fields- Throws:
DeletedObjectException
- if the object does not exist intx
StaleTransactionException
- iftx
is no longer usableUnknownTypeException
- ifid
specifies an unknown object typeIllegalArgumentException
- if any parameter is null
-