Class LJV


  • public final class LJV
    extends Object
    Lightweight Java Visualizer.
    • Constructor Detail

      • LJV

        public LJV()
    • Method Detail

      • setDirection

        public LJV setDirection​(Direction direction)
      • getDirection

        public Direction getDirection()
      • addClassAttribute

        public LJV addClassAttribute​(Class<?> cz,
                                     String attrib)
        Set the DOT attributes for a class. This allows you to change the appearance of certain nodes in the output, but requires that you know something about dot attributes. Simple attributes are, e.g., "color=red".
        Parameters:
        cz - class to set attribute for.
        attrib - DOT attributes for a class.
        Returns:
        current LJV object
      • getObjectAttributes

        public String getObjectAttributes​(Object o)
      • addFieldAttribute

        public LJV addFieldAttribute​(Field field,
                                     String attrib)
        Set the DOT attributes for a specific field. This allows you to change the appearance of certain edges in the output, but requires that you know something about dot attributes. Simple attributes are, e.g., "color=blue".
        Parameters:
        field - field to set attributes to
        attrib - field attributes
        Returns:
        this
      • getFieldAttributes

        public String getFieldAttributes​(Field field,
                                         Object value)
      • addFieldAttribute

        public LJV addFieldAttribute​(String field,
                                     String attrib)
        Set the DOT attributes for all fields with this name.
        Parameters:
        field - field name to set attributes to
        attrib - attributes
        Returns:
        current ljv object
      • addIgnoreField

        public LJV addIgnoreField​(Field field)
        Do not display this field.
        Parameters:
        field - field to ignore
        Returns:
        this
      • addIgnoreField

        public LJV addIgnoreField​(String field)
        Do not display any fields with this name.
        Parameters:
        field - field name to ignore
        Returns:
        this
      • addIgnoreFields

        public LJV addIgnoreFields​(Class<?> cz)
        Do not display any fields from this class.
        Parameters:
        cz - class to ignore fields
        Returns:
        this
      • addIgnoreClass

        public LJV addIgnoreClass​(Class<?> cz)
        Do not display any fields with this type.
        Parameters:
        cz - type of fields to ignore
        Returns:
        this
      • addIgnorePackage

        public LJV addIgnorePackage​(Package pk)
        Do not display any fields that have a type from this package.
        Parameters:
        pk - package that contains classes of fields that will not be displayed
        Returns:
        this
      • canIgnoreField

        public boolean canIgnoreField​(Field field)
      • highlightChangingArrayElements

        public LJV highlightChangingArrayElements()
        Enable highlighting array elements that was changed since previous run of ljv.
        Returns:
        current ljv object
      • highlightNewObjects

        public LJV highlightNewObjects()
        Enable highlighting of new objects that appeared since previous run of ljv.
        Returns:
        current ljv object
      • getArrayElementAttributes

        public String getArrayElementAttributes​(Object array,
                                                int index)
      • setTreatAsPrimitive

        public LJV setTreatAsPrimitive​(Class<?> cz)
        Treat objects of this class as primitives; i.e., toString is called on the object, and the result displayed in the label like a primitive field.
        Parameters:
        cz - Class of objects to be treated as primitives
        Returns:
        this
      • isTreatsAsPrimitive

        public boolean isTreatsAsPrimitive​(Class<?> cz)
      • setTreatAsPrimitive

        public LJV setTreatAsPrimitive​(Package pk)
        Treat objects from this package as primitives; i.e., toString is called on the object, and the result displayed in the label like a primitive field.
        Parameters:
        pk - Package with classes to treated as primitive
        Returns:
        this
      • isTreatsAsPrimitive

        public boolean isTreatsAsPrimitive​(Package pk)
      • setIgnorePrivateFields

        public LJV setIgnorePrivateFields​(boolean ignorePrivateFields)
      • isIgnorePrivateFields

        public boolean isIgnorePrivateFields()
      • setShowFieldNamesInLabels

        public LJV setShowFieldNamesInLabels​(boolean showFieldNamesInLabels)
      • isShowFieldNamesInLabels

        public boolean isShowFieldNamesInLabels()
      • setQualifyNestedClassNames

        public LJV setQualifyNestedClassNames​(boolean qualifyNestedClassNames)
      • isQualifyNestedClassNames

        public boolean isQualifyNestedClassNames()
      • setShowPackageNamesInClasses

        public LJV setShowPackageNamesInClasses​(boolean showPackageNamesInClasses)
      • isShowPackageNamesInClasses

        public boolean isShowPackageNamesInClasses()
      • setIgnoreNullValuedFields

        public LJV setIgnoreNullValuedFields​(boolean ignoreNullValuedFields)
        Toggle whether to ignore fields with null values.
        Parameters:
        ignoreNullValuedFields - true, if we want to hide the fields with null values.
        Returns:
        this
      • isIgnoreNullValuedFields

        public boolean isIgnoreNullValuedFields()
      • addRoot

        public LJV addRoot​(Object root)
        add an Object to roots
        Parameters:
        root - New root object to visialize
        Returns:
        this
      • drawGraph

        public String drawGraph​(Object obj)
        Create a graph of the object rooted at obj.
        Parameters:
        obj - object to be visualized
        Returns:
        String representation containing DOT commands to build the graph
      • drawGraph

        public String drawGraph()
        roots roots references counts can be visualized
        Returns:
        String representation containing DOT commands to build the graph