Package aQute.bnd.make.calltree
Class CalltreeResource
java.lang.Object
aQute.bnd.osgi.WriteResource
aQute.bnd.make.calltree.CalltreeResource
- All Implemented Interfaces:
Resource
,Closeable
,AutoCloseable
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>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)
.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Collection<Clazz>
(package private) static Comparator<Clazz.MethodDef>
-
Constructor Summary
ConstructorsConstructorDescriptionCalltreeResource
(Collection<Clazz> values) Create a resource for inclusion that will print a call tree. -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
getAccess
(int access) long
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
(PrintWriter out, String element, Clazz.MethodDef source, String closeElement) void
write
(OutputStream out) The write method is called to write the resource.static void
writeCalltree
(PrintWriter out, Collection<Clazz> classes) Print the call tree in XML.private static void
xref
(PrintWriter out, String group, Map<Clazz.MethodDef, Set<Clazz.MethodDef>> references) (package private) static void
xref
(Map<Clazz.MethodDef, 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 Details
-
classes
Collection<Clazz> classes -
COMPARATOR
-
-
Constructor Details
-
CalltreeResource
Create a resource for inclusion that will print a call tree.- Parameters:
values
- the classes for which the call tree is generated.
-
-
Method Details
-
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:
lastModified
in interfaceResource
- Specified by:
lastModified
in classWriteResource
-
write
The write method is called to write the resource. We just call the static method.- Specified by:
write
in interfaceResource
- Specified by:
write
in classWriteResource
- Throws:
Exception
-
writeCalltree
Print the call tree in XML.- Parameters:
out
- The output writerclasses
- The set of classes- Throws:
Exception
- Any errors
-
xref
static void xref(Map<Clazz.MethodDef, Set<Clazz.MethodDef>> references, Clazz.MethodDef source, Clazz.MethodDef reference) -
xref
private static void xref(PrintWriter out, String group, Map<Clazz.MethodDef, Set<Clazz.MethodDef>> references) -
method
private static void method(PrintWriter out, String element, Clazz.MethodDef source, String closeElement) -
getAccess
-