public class CalltreeResource extends WriteResource
calltree ::= <using> <usedby> using ::= <method> * usedby ::= <method> * method ::= <ref>The
using
element contains methods in the set of classes and
their references. The usedby
element contains the used methods
and their references to the set of classes. The ref
element
contains the class, the method name, the descriptor, and a pretty print
version of the method. The XML does not contain an XML processor instruction
to make it easier to include in other XML. The encoding is always UTF-8. This
class can be used as a resource, just add it to a JAR and the data is
generated when the resource is written (saving time when the JAR is up to
date and does not have to be generated). However, the actual write method is
a static method and can be called as well:
writeCalltree(PrintWriter, Collection)
.Modifier and Type | Field and Description |
---|---|
(package private) java.util.Collection<Clazz> |
classes |
(package private) static java.util.Comparator<Clazz.MethodDef> |
COMPARATOR |
Constructor and Description |
---|
CalltreeResource(java.util.Collection<Clazz> values)
Create a resource for inclusion that will print a call tree.
|
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
getAccess(int access) |
long |
lastModified()
We set the last modified to 0 so this resource does not force a new JAR
if all other resources are up to date.
|
private static void |
method(java.io.PrintWriter out,
java.lang.String element,
Clazz.MethodDef source,
java.lang.String closeElement) |
void |
write(java.io.OutputStream out)
The write method is called to write the resource.
|
static void |
writeCalltree(java.io.PrintWriter out,
java.util.Collection<Clazz> classes)
Print the call tree in XML.
|
(package private) static void |
xref(java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references,
Clazz.MethodDef source,
Clazz.MethodDef reference) |
private static void |
xref(java.io.PrintWriter out,
java.lang.String group,
java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references) |
buffer, close, getExtra, openInputStream, setExtra, size
java.util.Collection<Clazz> classes
static java.util.Comparator<Clazz.MethodDef> COMPARATOR
public CalltreeResource(java.util.Collection<Clazz> values)
values
- the classes for which the call tree is generated.public long lastModified()
lastModified
in interface Resource
lastModified
in class WriteResource
public void write(java.io.OutputStream out) throws java.lang.Exception
write
in interface Resource
write
in class WriteResource
java.lang.Exception
public static void writeCalltree(java.io.PrintWriter out, java.util.Collection<Clazz> classes) throws java.lang.Exception
out
- The output writerclasses
- The set of classesjava.lang.Exception
- Any errorsstatic void xref(java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references, Clazz.MethodDef source, Clazz.MethodDef reference)
private static void xref(java.io.PrintWriter out, java.lang.String group, java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references)
private static void method(java.io.PrintWriter out, java.lang.String element, Clazz.MethodDef source, java.lang.String closeElement)
private static java.lang.String getAccess(int access)