Package aQute.bnd.make.calltree
Class CalltreeResource
- java.lang.Object
-
- aQute.bnd.osgi.WriteResource
-
- aQute.bnd.make.calltree.CalltreeResource
-
- All Implemented Interfaces:
Resource,java.io.Closeable,java.lang.AutoCloseable
public class CalltreeResource extends WriteResource
Create an XML call tree of a set of classes. The structure of the XML is:calltree ::= <using> <usedby> using ::= <method> * usedby ::= <method> * method ::= <ref>
Theusingelement contains methods in the set of classes and their references. Theusedbyelement contains the used methods and their references to the set of classes. Therefelement 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).
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Collection<Clazz>classes(package private) static java.util.Comparator<Clazz.MethodDef>COMPARATOR
-
Constructor Summary
Constructors Constructor Description CalltreeResource(java.util.Collection<Clazz> values)Create a resource for inclusion that will print a call tree.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringgetAccess(int access)longlastModified()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 voidmethod(java.io.PrintWriter out, java.lang.String element, Clazz.MethodDef source, java.lang.String closeElement)voidwrite(java.io.OutputStream out)The write method is called to write the resource.static voidwriteCalltree(java.io.PrintWriter out, java.util.Collection<Clazz> classes)Print the call tree in XML.private static voidxref(java.io.PrintWriter out, java.lang.String group, java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references)(package private) static voidxref(java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references, Clazz.MethodDef source, Clazz.MethodDef reference)-
Methods inherited from class aQute.bnd.osgi.WriteResource
buffer, close, getExtra, openInputStream, setExtra, size
-
-
-
-
Field Detail
-
classes
java.util.Collection<Clazz> classes
-
COMPARATOR
static java.util.Comparator<Clazz.MethodDef> COMPARATOR
-
-
Constructor Detail
-
CalltreeResource
public CalltreeResource(java.util.Collection<Clazz> values)
Create a resource for inclusion that will print a call tree.- Parameters:
values- the classes for which the call tree is generated.
-
-
Method Detail
-
lastModified
public 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.- Specified by:
lastModifiedin interfaceResource- Specified by:
lastModifiedin classWriteResource
-
write
public void write(java.io.OutputStream out) throws java.lang.ExceptionThe write method is called to write the resource. We just call the static method.- Specified by:
writein interfaceResource- Specified by:
writein classWriteResource- Throws:
java.lang.Exception
-
writeCalltree
public static void writeCalltree(java.io.PrintWriter out, java.util.Collection<Clazz> classes) throws java.lang.ExceptionPrint the call tree in XML.- Parameters:
out- The output writerclasses- The set of classes- Throws:
java.lang.Exception- Any errors
-
xref
static void xref(java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references, Clazz.MethodDef source, Clazz.MethodDef reference)
-
xref
private static void xref(java.io.PrintWriter out, java.lang.String group, java.util.Map<Clazz.MethodDef,java.util.Set<Clazz.MethodDef>> references)
-
method
private static void method(java.io.PrintWriter out, java.lang.String element, Clazz.MethodDef source, java.lang.String closeElement)
-
getAccess
private static java.lang.String getAccess(int access)
-
-