Package org.atpfivt.ljv
Class LJV
- java.lang.Object
-
- org.atpfivt.ljv.LJV
-
public final class LJV extends Object
Lightweight Java Visualizer.
-
-
Constructor Summary
Constructors Constructor Description LJV()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LJVaddArrayElementAttributeProvider(ArrayElementAttributeProvider provider)LJVaddClassAttribute(Class<?> cz, String attrib)Set the DOT attributes for a class.LJVaddFieldAttribute(Field field, String attrib)Set the DOT attributes for a specific field.LJVaddFieldAttribute(String field, String attrib)Set the DOT attributes for all fields with this name.LJVaddFieldAttributesProvider(FieldAttributesProvider provider)LJVaddIgnoreClass(Class<?> cz)Do not display any fields with this type.LJVaddIgnoreField(Field field)Do not display this field.LJVaddIgnoreField(String field)Do not display any fields with this name.LJVaddIgnoreFields(Class<?> cz)Do not display any fields from this class.LJVaddIgnorePackage(Package pk)Do not display any fields that have a type from this package.LJVaddObjectAttributesProvider(ObjectAttributesProvider provider)LJVaddRoot(Object root)add an Object torootsbooleancanIgnoreField(Field field)StringdrawGraph()rootsrootsreferences counts can be visualizedStringdrawGraph(Object obj)Create a graph of the object rooted atobj.StringgetArrayElementAttributes(Object array, int index)DirectiongetDirection()StringgetFieldAttributes(Field field, Object value)StringgetObjectAttributes(Object o)LJVhighlightChangingArrayElements()Enable highlighting array elements that was changed since previous run of ljv.LJVhighlightNewObjects()Enable highlighting of new objects that appeared since previous run of ljv.booleanisIgnoreNullValuedFields()booleanisIgnorePrivateFields()booleanisQualifyNestedClassNames()booleanisShowFieldNamesInLabels()booleanisShowPackageNamesInClasses()booleanisTreatsAsPrimitive(Class<?> cz)booleanisTreatsAsPrimitive(Package pk)LJVsetDirection(Direction direction)LJVsetIgnoreNullValuedFields(boolean ignoreNullValuedFields)Toggle whether to ignore fields with null values.LJVsetIgnorePrivateFields(boolean ignorePrivateFields)LJVsetQualifyNestedClassNames(boolean qualifyNestedClassNames)LJVsetShowFieldNamesInLabels(boolean showFieldNamesInLabels)LJVsetShowPackageNamesInClasses(boolean showPackageNamesInClasses)LJVsetTreatAsPrimitive(Class<?> cz)Treat objects of this class as primitives; i.e.,toStringis called on the object, and the result displayed in the label like a primitive field.LJVsetTreatAsPrimitive(Package pk)Treat objects from this package as primitives; i.e.,toStringis called on the object, and the result displayed in the label like a primitive field.
-
-
-
Method Detail
-
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
-
addObjectAttributesProvider
public LJV addObjectAttributesProvider(ObjectAttributesProvider provider)
-
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 toattrib- field attributes- Returns:
- this
-
addFieldAttributesProvider
public LJV addFieldAttributesProvider(FieldAttributesProvider provider)
-
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 toattrib- 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)
-
addArrayElementAttributeProvider
public LJV addArrayElementAttributeProvider(ArrayElementAttributeProvider provider)
-
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
-
setTreatAsPrimitive
public LJV setTreatAsPrimitive(Class<?> cz)
Treat objects of this class as primitives; i.e.,toStringis 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.,toStringis 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 toroots- Parameters:
root- New root object to visialize- Returns:
- this
-
drawGraph
public String drawGraph(Object obj)
Create a graph of the object rooted atobj.- Parameters:
obj- object to be visualized- Returns:
- String representation containing DOT commands to build the graph
-
drawGraph
public String drawGraph()
rootsrootsreferences counts can be visualized- Returns:
- String representation containing DOT commands to build the graph
-
-