Class ObjectDumper


  • public class ObjectDumper
    extends ObjectVisitor
    This is a concrete object visitor that will build up a structured human-readable string representation of an object.
    Author:
    Simon Thoresen Hult
    • Constructor Detail

      • ObjectDumper

        public ObjectDumper()
        Create an object dumper with the default indent size.
      • ObjectDumper

        public ObjectDumper​(int indent)
        Create an object dumper with the given indent size.
        Parameters:
        indent - indent size in number of spaces
    • Method Detail

      • toString

        public String toString()
        Obtain the created object string representation. This object should be invoked after the complete object structure has been visited.
        Overrides:
        toString in class Object
        Returns:
        object string representation
      • openStruct

        public void openStruct​(String name,
                               String type)
        Description copied from class: ObjectVisitor
        Open a (sub-)structure
        Specified by:
        openStruct in class ObjectVisitor
        Parameters:
        name - name of structure
        type - type of structure
      • visit

        public void visit​(String name,
                          Object obj)
        Description copied from class: ObjectVisitor
        Visits some object.
        Specified by:
        visit in class ObjectVisitor
        Parameters:
        name - variable name
        obj - object to visit