Class ObjectDumper

java.lang.Object
com.yahoo.vespa.objects.ObjectVisitor
com.yahoo.vespa.objects.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 Details

    • 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 Details

    • 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
    • closeStruct

      public void closeStruct()
      Description copied from class: ObjectVisitor
      Close a (sub-)structure
      Specified by:
      closeStruct in class ObjectVisitor
    • 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