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 Summary

      Constructors 
      Constructor Description
      ObjectDumper()
      Create an object dumper with the default indent size.
      ObjectDumper​(int indent)
      Create an object dumper with the given indent size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeStruct()
      Close a (sub-)structure
      void openStruct​(java.lang.String name, java.lang.String type)
      Open a (sub-)structure
      java.lang.String toString()
      Obtain the created object string representation.
      void visit​(java.lang.String name, java.lang.Object obj)
      Visits some object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 java.lang.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 java.lang.Object
        Returns:
        object string representation
      • openStruct

        public void openStruct​(java.lang.String name,
                               java.lang.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​(java.lang.String name,
                          java.lang.Object obj)
        Description copied from class: ObjectVisitor
        Visits some object.
        Specified by:
        visit in class ObjectVisitor
        Parameters:
        name - variable name
        obj - object to visit