class ClassGraph
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ClassGraph.Align |
private static class |
ClassGraph.FieldRelationInfo |
(package private) static class |
ClassGraph.Font |
Modifier and Type | Field and Description |
---|---|
static java.util.Map<RelationType,java.lang.String> |
associationMap |
protected java.util.Map<java.lang.String,ClassInfo> |
classnames |
protected com.sun.javadoc.ClassDoc |
collectionClassDoc |
protected com.sun.javadoc.Doc |
contextDoc |
protected static char |
FILE_SEPARATOR |
protected java.lang.String |
linePostfix |
protected java.lang.String |
linePrefix |
protected com.sun.javadoc.ClassDoc |
mapClassDoc |
protected OptionProvider |
optionProvider |
protected java.util.Map<java.lang.String,com.sun.javadoc.ClassDoc> |
rootClassdocs |
protected java.util.Set<java.lang.String> |
rootClasses |
protected java.io.PrintWriter |
w |
Constructor and Description |
---|
ClassGraph(com.sun.javadoc.RootDoc root,
OptionProvider optionProvider,
com.sun.javadoc.Doc contextDoc)
Create a new ClassGraph.
|
Modifier and Type | Method and Description |
---|---|
private void |
allRelation(Options opt,
RelationType rt,
com.sun.javadoc.ClassDoc from)
Print all relations for a given's class's tag
|
private void |
attributes(Options opt,
com.sun.javadoc.FieldDoc[] fd)
Print the class's attributes fd
|
protected static java.lang.String |
buildRelativePath(java.lang.String contextPackageName,
java.lang.String classPackageName) |
java.lang.String |
classToUrl(com.sun.javadoc.ClassDoc cd,
boolean rootClass)
Convert the class name into a corresponding URL
|
java.lang.String |
classToUrl(java.lang.String className)
Convert the class name into a corresponding URL
|
void |
epilogue()
Dot epilogue
|
private java.lang.String |
escape(java.lang.String s)
Escape <, >, and & characters in the string with
the corresponding HTML entity code.
|
private void |
externalTableEnd() |
private void |
externalTableStart(Options opt,
java.lang.String name,
java.lang.String url) |
private <T extends com.sun.javadoc.ProgramElementDoc> |
filterByVisibility(T[] docs,
Visibility visibility)
Returns all program element docs that have a visibility greater or
equal than the specified level
|
private void |
firstInnerTableEnd(Options opt,
int nRows)
End the first inner table of a class.
|
private void |
firstInnerTableStart(Options opt,
int nRows)
Start the first inner table of a class.
|
private java.lang.String |
fontWrap(java.lang.String text,
Options opt,
ClassGraph.Font font)
Wraps the text with the appropriate font according to the specified font type
|
private java.lang.String |
fontWrap(java.lang.String text,
java.lang.String fontName,
double fontSize)
Wraps the text with the appropriate font tags when the font name
and size are not void
|
protected ClassInfo |
getClassInfo(java.lang.String className) |
private ClassGraph.FieldRelationInfo |
getFieldRelationInfo(com.sun.javadoc.FieldDoc field) |
private com.sun.javadoc.Type[] |
getInterfaceTypeArguments(com.sun.javadoc.ClassDoc iface,
com.sun.javadoc.Type t) |
private java.lang.String |
getNodeName(com.sun.javadoc.ClassDoc c) |
private java.lang.String |
getNodeName(java.lang.String c)
Return a class's internal name
|
private java.lang.String |
getPackageName(java.lang.String className) |
private java.lang.String |
getUnqualifiedName(java.lang.String className) |
private java.lang.String |
guillemize(Options opt,
java.lang.String s)
Convert < and > characters in the string to the respective guillemot characters.
|
private java.lang.String |
guilWrap(Options opt,
java.lang.String str)
Wraps a string in Guillemot (or an ASCII substitute) characters.
|
private boolean |
hidden(com.sun.javadoc.ProgramElementDoc c)
Return true if c has a @hidden tag associated with it
|
private boolean |
hidden(java.lang.String s)
Return true if the class name is associated to an hidden class or matches a hide expression
|
private java.lang.String |
htmlNewline(java.lang.String s)
Convert embedded newlines into HTML line breaks
|
private void |
innerTableEnd() |
private void |
innerTableStart() |
private java.lang.String |
mapApiDocRoot(java.lang.String className)
Returns the appropriate URL "root" for a given class name.
|
private ClassInfo |
newClassInfo(java.lang.String className,
boolean printed,
boolean hidden) |
private void |
nodeProperties(Options opt)
Print the common class node's properties
|
private boolean |
operations(Options opt,
com.sun.javadoc.ConstructorDoc[] m)
Print the class's constructors m
|
private boolean |
operations(Options opt,
com.sun.javadoc.MethodDoc[] m)
Print the class's operations m
|
private java.lang.String |
parameter(Options opt,
com.sun.javadoc.Parameter[] p)
Print the method parameter p
|
java.lang.String |
printClass(com.sun.javadoc.ClassDoc c,
boolean rootClass)
Prints the class if needed.
|
void |
printExtraClasses(com.sun.javadoc.RootDoc root)
Print classes that were parts of relationships, but not parsed by javadoc
|
void |
printInferredDependencies(com.sun.javadoc.ClassDoc c)
Prints dependencies recovered from the methods of a class.
|
void |
printInferredDependencies(com.sun.javadoc.ClassDoc[] classes)
Prints dependencies recovered from the methods of a class.
|
void |
printInferredRelations(com.sun.javadoc.ClassDoc c)
Prints associations recovered from the fields of a class.
|
void |
printInferredRelations(com.sun.javadoc.ClassDoc[] classes)
Prints associations recovered from the fields of a class.
|
void |
printRelations(com.sun.javadoc.ClassDoc c)
Print a class's relations
|
void |
prologue()
Dot prologue
|
private java.lang.String |
qualifiedName(Options opt,
java.lang.String r)
Return the class's name, possibly by stripping the leading path
|
private void |
relation(Options opt,
RelationType rt,
com.sun.javadoc.ClassDoc from,
com.sun.javadoc.ClassDoc to,
java.lang.String tailLabel,
java.lang.String label,
java.lang.String headLabel)
Print the specified relation
|
private void |
relation(Options opt,
RelationType rt,
com.sun.javadoc.ClassDoc from,
java.lang.String fromName,
com.sun.javadoc.ClassDoc to,
java.lang.String toName,
java.lang.String tailLabel,
java.lang.String label,
java.lang.String headLabel)
Print the specified relation
|
private java.lang.String |
relationNode(com.sun.javadoc.ClassDoc c)
Return the full name of a relation's node.
|
private java.lang.String |
relationNode(com.sun.javadoc.ClassDoc c,
java.lang.String cName)
Return the full name of a relation's node c.
|
private java.lang.String |
removeTemplate(java.lang.String name)
Removes the template specs from a class name.
|
private void |
stereotype(Options opt,
com.sun.javadoc.Doc c,
ClassGraph.Align align)
Return as a string the stereotypes associated with c
terminated by the escape character term
|
private void |
tableLine(ClassGraph.Align align,
java.lang.String text) |
private void |
tableLine(ClassGraph.Align align,
java.lang.String text,
Options opt,
ClassGraph.Font font) |
private void |
tagvalue(Options opt,
com.sun.javadoc.Doc c)
Return as a string the tagged values associated with c
|
private java.lang.String |
type(Options opt,
com.sun.javadoc.Type t)
Print a a basic type t
|
private java.lang.String |
typeAnnotation(Options opt,
com.sun.javadoc.Type t)
Annotate an field/argument with its type t
|
private java.lang.String |
typeParameters(Options opt,
com.sun.javadoc.ParameterizedType t)
Print the parameters of the parameterized type t
|
private java.lang.String |
visibility(Options opt,
com.sun.javadoc.ProgramElementDoc e)
Print the visibility adornment of element e prefixed by
any stereotypes
|
protected static final char FILE_SEPARATOR
public static java.util.Map<RelationType,java.lang.String> associationMap
protected java.util.Map<java.lang.String,ClassInfo> classnames
protected java.util.Set<java.lang.String> rootClasses
protected java.util.Map<java.lang.String,com.sun.javadoc.ClassDoc> rootClassdocs
protected OptionProvider optionProvider
protected java.io.PrintWriter w
protected com.sun.javadoc.ClassDoc collectionClassDoc
protected com.sun.javadoc.ClassDoc mapClassDoc
protected java.lang.String linePostfix
protected java.lang.String linePrefix
protected com.sun.javadoc.Doc contextDoc
public ClassGraph(com.sun.javadoc.RootDoc root, OptionProvider optionProvider, com.sun.javadoc.Doc contextDoc)
The packages passed as an argument are the ones specified on the command line.
Local URLs will be generated for these packages.
root
- The root of docs as provided by the javadoc APIoptionProvider
- The main option providercontextDoc
- The current context for generating relative links, may be a ClassDoc
or a PackageDoc (used by UMLDoc)private java.lang.String qualifiedName(Options opt, java.lang.String r)
private java.lang.String escape(java.lang.String s)
private java.lang.String htmlNewline(java.lang.String s)
private java.lang.String guillemize(Options opt, java.lang.String s)
private java.lang.String guilWrap(Options opt, java.lang.String str)
str
- the String
to be wrapped.String
.private java.lang.String visibility(Options opt, com.sun.javadoc.ProgramElementDoc e)
private java.lang.String parameter(Options opt, com.sun.javadoc.Parameter[] p)
private java.lang.String type(Options opt, com.sun.javadoc.Type t)
private java.lang.String typeParameters(Options opt, com.sun.javadoc.ParameterizedType t)
private java.lang.String typeAnnotation(Options opt, com.sun.javadoc.Type t)
private void attributes(Options opt, com.sun.javadoc.FieldDoc[] fd)
private boolean operations(Options opt, com.sun.javadoc.ConstructorDoc[] m)
private boolean operations(Options opt, com.sun.javadoc.MethodDoc[] m)
private void nodeProperties(Options opt)
private void tagvalue(Options opt, com.sun.javadoc.Doc c)
opt
- the Options used to guess font namesc
- the Doc entry to look for @tagvalueprevterm
- the termination string for the previous elementterm
- the termination character for each tagged valueprivate void stereotype(Options opt, com.sun.javadoc.Doc c, ClassGraph.Align align)
private boolean hidden(com.sun.javadoc.ProgramElementDoc c)
protected ClassInfo getClassInfo(java.lang.String className)
private ClassInfo newClassInfo(java.lang.String className, boolean printed, boolean hidden)
private boolean hidden(java.lang.String s)
public java.lang.String printClass(com.sun.javadoc.ClassDoc c, boolean rootClass)
A class is a rootClass if it's included among the classes returned by RootDoc.classes(), this information is used to properly compute relative links in diagrams for UMLDoc
private java.lang.String getNodeName(com.sun.javadoc.ClassDoc c)
private java.lang.String getNodeName(java.lang.String c)
private void allRelation(Options opt, RelationType rt, com.sun.javadoc.ClassDoc from)
tagname
- the tag containing the given relationfrom
- the source classedgetype
- the dot edge specificationprivate void relation(Options opt, RelationType rt, com.sun.javadoc.ClassDoc from, java.lang.String fromName, com.sun.javadoc.ClassDoc to, java.lang.String toName, java.lang.String tailLabel, java.lang.String label, java.lang.String headLabel)
from
- the source class (may be null)fromName
- the source class's nameto
- the destination class (may be null)toName
- the destination class's nameprivate void relation(Options opt, RelationType rt, com.sun.javadoc.ClassDoc from, com.sun.javadoc.ClassDoc to, java.lang.String tailLabel, java.lang.String label, java.lang.String headLabel)
from
- the source classto
- the destination classprivate java.lang.String relationNode(com.sun.javadoc.ClassDoc c)
private java.lang.String relationNode(com.sun.javadoc.ClassDoc c, java.lang.String cName)
c
- the node's class (may be null)cName
- the node's class namepublic void printRelations(com.sun.javadoc.ClassDoc c)
public void printExtraClasses(com.sun.javadoc.RootDoc root)
public void printInferredRelations(com.sun.javadoc.ClassDoc[] classes)
classes
- public void printInferredRelations(com.sun.javadoc.ClassDoc c)
classes
- public void printInferredDependencies(com.sun.javadoc.ClassDoc[] classes)
classes
- public void printInferredDependencies(com.sun.javadoc.ClassDoc c)
classes
- private <T extends com.sun.javadoc.ProgramElementDoc> java.util.List<T> filterByVisibility(T[] docs, Visibility visibility)
private ClassGraph.FieldRelationInfo getFieldRelationInfo(com.sun.javadoc.FieldDoc field)
private com.sun.javadoc.Type[] getInterfaceTypeArguments(com.sun.javadoc.ClassDoc iface, com.sun.javadoc.Type t)
private java.lang.String removeTemplate(java.lang.String name)
public java.lang.String classToUrl(com.sun.javadoc.ClassDoc cd, boolean rootClass)
protected static java.lang.String buildRelativePath(java.lang.String contextPackageName, java.lang.String classPackageName)
private java.lang.String getPackageName(java.lang.String className)
private java.lang.String getUnqualifiedName(java.lang.String className)
public java.lang.String classToUrl(java.lang.String className)
private java.lang.String mapApiDocRoot(java.lang.String className)
public void prologue() throws java.io.IOException
java.io.IOException
public void epilogue()
private void externalTableStart(Options opt, java.lang.String name, java.lang.String url)
private void externalTableEnd()
private void innerTableStart()
private void firstInnerTableStart(Options opt, int nRows)
nRows
- the total number of rows in this table.private void innerTableEnd()
private void firstInnerTableEnd(Options opt, int nRows)
nRows
- the total number of rows in this table.private void tableLine(ClassGraph.Align align, java.lang.String text)
private void tableLine(ClassGraph.Align align, java.lang.String text, Options opt, ClassGraph.Font font)
private java.lang.String fontWrap(java.lang.String text, Options opt, ClassGraph.Font font)
opt
- text
- font
- private java.lang.String fontWrap(java.lang.String text, java.lang.String fontName, double fontSize)
text
- the text to be wrappedfontName
- considered void when it's nullfontSize
- considered void when it's <= 0