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 LJV
addArrayElementAttributeProvider(ArrayElementAttributeProvider provider)
LJV
addClassAttribute(Class<?> cz, String attrib)
Set the DOT attributes for a class.LJV
addFieldAttribute(Field field, String attrib)
Set the DOT attributes for a specific field.LJV
addFieldAttribute(String field, String attrib)
Set the DOT attributes for all fields with this name.LJV
addFieldAttributesProvider(FieldAttributesProvider provider)
LJV
addIgnoreClass(Class<?> cz)
Do not display any fields with this type.LJV
addIgnoreField(Field field)
Do not display this field.LJV
addIgnoreField(String field)
Do not display any fields with this name.LJV
addIgnoreFields(Class<?> cz)
Do not display any fields from this class.LJV
addIgnorePackage(Package pk)
Do not display any fields that have a type from this package.LJV
addObjectAttributesProvider(ObjectAttributesProvider provider)
LJV
addRoot(Object root)
add an Object toroots
boolean
canIgnoreField(Field field)
String
drawGraph()
rootsroots
references counts can be visualizedString
drawGraph(Object obj)
Create a graph of the object rooted atobj
.String
getArrayElementAttributes(Object array, int index)
Direction
getDirection()
String
getFieldAttributes(Field field, Object value)
String
getObjectAttributes(Object o)
LJV
highlightChangingArrayElements()
Enable highlighting array elements that was changed since previous run of ljv.LJV
highlightNewObjects()
Enable highlighting of new objects that appeared since previous run of ljv.boolean
isIgnoreNullValuedFields()
boolean
isIgnorePrivateFields()
boolean
isQualifyNestedClassNames()
boolean
isShowFieldNamesInLabels()
boolean
isShowPackageNamesInClasses()
boolean
isTreatsAsPrimitive(Class<?> cz)
boolean
isTreatsAsPrimitive(Package pk)
LJV
setDirection(Direction direction)
LJV
setIgnoreNullValuedFields(boolean ignoreNullValuedFields)
Toggle whether to ignore fields with null values.LJV
setIgnorePrivateFields(boolean ignorePrivateFields)
LJV
setQualifyNestedClassNames(boolean qualifyNestedClassNames)
LJV
setShowFieldNamesInLabels(boolean showFieldNamesInLabels)
LJV
setShowPackageNamesInClasses(boolean showPackageNamesInClasses)
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.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.
-
-
-
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.,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 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()
rootsroots
references counts can be visualized- Returns:
- String representation containing DOT commands to build the graph
-
-