Class UsageGraph
- java.lang.Object
-
- net.sourceforge.pmd.dcd.graph.UsageGraph
-
- All Implemented Interfaces:
NodeVisitorAcceptor
@Deprecated public class UsageGraph extends Object implements NodeVisitorAcceptor
Deprecated.SeeDCD
A UsageGraph tracks usage references between Java classes, based upon a parsing of the class files. Once the UsageGraph is built, it may be visited to perform additional post-processing, or usage relationship analysis.The UsageGraph is composed of ClassNodes. Each ClassNode has various MemberNodes, specifically ConstructorNodes, FieldNodes, and MethodNodes. Each of these MemberNodes keeps track of other MemberNodes which it uses and other MemberNodes which are users of it. In this sense, the graph can navigated bi-directionally across the use relationship between MemberNodes.
Great effort is taken to keep the bookkeeping of the UsageGraph as tight as possible, so that rather large code bases can be analyzed. While nodes can grant access to the underlying Java Reflection APIs (e.g. Class, Constructor, Field, Member), the results are stored using WeakReferences to assist with memory usage.
A class Filter can be specified to limit the set of classes on which usage references will be tracked. This is often done to limit memory usage to interesting classes. For example, the
java.util
package is very often used, and tracking usages would require a massive bookkeeping effort which has little value.
-
-
Field Summary
Fields Modifier and Type Field Description protected Filter<String>
classFilter
Deprecated.
-
Constructor Summary
Constructors Constructor Description UsageGraph(Filter<String> classFilter)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Object
accept(NodeVisitor visitor, Object data)
Deprecated.ClassNode
defineClass(String className)
Deprecated.MemberNode
defineConstructor(String className, String name, String desc)
Deprecated.FieldNode
defineField(String className, String name, String desc)
Deprecated.MemberNode
defineMethod(String className, String name, String desc)
Deprecated.boolean
isClass(String className)
Deprecated.void
usageField(String className, String name, String desc, MemberNode usingMemberNode)
Deprecated.void
usageMethod(String className, String name, String desc, MemberNode usingMemberNode)
Deprecated.
-
-
-
Method Detail
-
accept
public Object accept(NodeVisitor visitor, Object data)
Deprecated.- Specified by:
accept
in interfaceNodeVisitorAcceptor
-
isClass
public boolean isClass(String className)
Deprecated.
-
defineConstructor
public MemberNode defineConstructor(String className, String name, String desc)
Deprecated.
-
defineMethod
public MemberNode defineMethod(String className, String name, String desc)
Deprecated.
-
usageField
public void usageField(String className, String name, String desc, MemberNode usingMemberNode)
Deprecated.
-
usageMethod
public void usageMethod(String className, String name, String desc, MemberNode usingMemberNode)
Deprecated.
-
-