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 voidprint(PrintWriter writer, Transaction tx, ObjId id, int maxCollectionEntries) Print the content of the given object's fields in a human readable format.static StringtoString(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
txis no longer valid - Throws:
IllegalArgumentException- iftxoridis 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 intxStaleTransactionException- iftxis no longer usableUnknownTypeException- ifidspecifies an unknown object typeIllegalArgumentException- if any parameter is null
-