class ClassGraph extends 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 Map<RelationType,String> |
associationMap |
protected Map<String,ClassInfo> |
classnames |
protected ClassDoc |
collectionClassDoc |
protected Doc |
contextDoc |
protected static char |
FILE_SEPARATOR |
protected String |
linePostfix |
protected String |
linePrefix |
protected ClassDoc |
mapClassDoc |
protected OptionProvider |
optionProvider |
protected Map<String,ClassDoc> |
rootClassdocs |
protected Set<String> |
rootClasses |
protected PrintWriter |
w |
Constructor and Description |
---|
ClassGraph(RootDoc root,
OptionProvider optionProvider,
Doc contextDoc)
Create a new ClassGraph.
|
Modifier and Type | Method and Description |
---|---|
private void |
allRelation(Options opt,
RelationType rt,
ClassDoc from)
Print all relations for a given's class's tag
|
private void |
attributes(Options opt,
FieldDoc[] fd)
Print the class's attributes fd
|
protected static String |
buildRelativePath(String contextPackageName,
String classPackageName) |
String |
classToUrl(ClassDoc cd,
boolean rootClass)
Convert the class name into a corresponding URL
|
String |
classToUrl(String className)
Convert the class name into a corresponding URL
|
void |
epilogue()
Dot epilogue
|
private String |
escape(String s)
Escape <, >, and & characters in the string with
the corresponding HTML entity code.
|
private void |
externalTableEnd() |
private void |
externalTableStart(Options opt,
String name,
String url) |
private <T extends 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 String |
fontWrap(String text,
Options opt,
ClassGraph.Font font)
Wraps the text with the appropriate font according to the specified font type
|
private String |
fontWrap(String text,
String fontName,
double fontSize)
Wraps the text with the appropriate font tags when the font name
and size are not void
|
protected ClassInfo |
getClassInfo(String className) |
private ClassGraph.FieldRelationInfo |
getFieldRelationInfo(FieldDoc field) |
private Type[] |
getInterfaceTypeArguments(ClassDoc iface,
Type t) |
private String |
getNodeName(ClassDoc c) |
private String |
getNodeName(String c)
Return a class's internal name
|
private String |
getPackageName(String className) |
private String |
getUnqualifiedName(String className) |
private String |
guillemize(Options opt,
String s)
Convert < and > characters in the string to the respective guillemot characters.
|
private String |
guilWrap(Options opt,
String str)
Wraps a string in Guillemot (or an ASCII substitute) characters.
|
private boolean |
hidden(ProgramElementDoc c)
Return true if c has a @hidden tag associated with it
|
private boolean |
hidden(String s)
Return true if the class name is associated to an hidden class or matches a hide expression
|
private String |
htmlNewline(String s)
Convert embedded newlines into HTML line breaks
|
(package private) ClassDoc[] |
importedClasses(ClassDoc c)
Returns an array representing the imported classes of c.
|
private void |
innerTableEnd() |
private void |
innerTableStart() |
private String |
mapApiDocRoot(String className)
Returns the appropriate URL "root" for a given class name.
|
private ClassInfo |
newClassInfo(String className,
boolean printed,
boolean hidden) |
private void |
nodeProperties(Options opt)
Print the common class node's properties
|
private boolean |
operations(Options opt,
ConstructorDoc[] m)
Print the class's constructors m
|
private boolean |
operations(Options opt,
MethodDoc[] m)
Print the class's operations m
|
private String |
parameter(Options opt,
Parameter[] p)
Print the method parameter p
|
String |
printClass(ClassDoc c,
boolean rootClass)
Prints the class if needed.
|
void |
printExtraClasses(RootDoc root)
Print classes that were parts of relationships, but not parsed by javadoc
|
void |
printInferredDependencies(ClassDoc c)
Prints dependencies recovered from the methods of a class.
|
void |
printInferredDependencies(ClassDoc[] classes)
Prints dependencies recovered from the methods of a class.
|
void |
printInferredRelations(ClassDoc c)
Prints associations recovered from the fields of a class.
|
void |
printInferredRelations(ClassDoc[] classes)
Prints associations recovered from the fields of a class.
|
void |
printRelations(ClassDoc c)
Print a class's relations
|
void |
prologue()
Dot prologue
|
private String |
qualifiedName(Options opt,
String r)
Return the class's name, possibly by stripping the leading path
|
private void |
relation(Options opt,
RelationType rt,
ClassDoc from,
ClassDoc to,
String tailLabel,
String label,
String headLabel)
Print the specified relation
|
private void |
relation(Options opt,
RelationType rt,
ClassDoc from,
String fromName,
ClassDoc to,
String toName,
String tailLabel,
String label,
String headLabel)
Print the specified relation
|
private String |
relationNode(ClassDoc c)
Return the full name of a relation's node.
|
private String |
relationNode(ClassDoc c,
String cName)
Return the full name of a relation's node c.
|
private String |
removeTemplate(String name)
Removes the template specs from a class name.
|
private void |
stereotype(Options opt,
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,
String text) |
private void |
tableLine(ClassGraph.Align align,
String text,
Options opt,
ClassGraph.Font font) |
private void |
tagvalue(Options opt,
Doc c)
Return as a string the tagged values associated with c
|
private String |
type(Options opt,
Type t)
Print a a basic type t
|
private String |
typeAnnotation(Options opt,
Type t)
Annotate an field/argument with its type t
|
private String |
typeParameters(Options opt,
ParameterizedType t)
Print the parameters of the parameterized type t
|
private String |
visibility(Options opt,
ProgramElementDoc e)
Print the visibility adornment of element e prefixed by
any stereotypes
|
protected static final char FILE_SEPARATOR
public static Map<RelationType,String> associationMap
protected OptionProvider optionProvider
protected PrintWriter w
protected ClassDoc collectionClassDoc
protected ClassDoc mapClassDoc
protected String linePostfix
protected String linePrefix
protected Doc contextDoc
public ClassGraph(RootDoc root, OptionProvider optionProvider, 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 String qualifiedName(Options opt, String r)
private String escape(String s)
private String guillemize(Options opt, String s)
private String guilWrap(Options opt, String str)
str
- the String
to be wrapped.String
.private String visibility(Options opt, ProgramElementDoc e)
private String typeParameters(Options opt, ParameterizedType t)
private String typeAnnotation(Options opt, Type t)
private boolean operations(Options opt, ConstructorDoc[] m)
private void nodeProperties(Options opt)
private void tagvalue(Options opt, 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, Doc c, ClassGraph.Align align)
private boolean hidden(ProgramElementDoc c)
private boolean hidden(String s)
public String printClass(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 void allRelation(Options opt, RelationType rt, ClassDoc from)
tagname
- the tag containing the given relationfrom
- the source classedgetype
- the dot edge specificationprivate void relation(Options opt, RelationType rt, ClassDoc from, String fromName, ClassDoc to, String toName, String tailLabel, String label, 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, ClassDoc from, ClassDoc to, String tailLabel, String label, String headLabel)
from
- the source classto
- the destination classprivate String relationNode(ClassDoc c)
private String relationNode(ClassDoc c, String cName)
c
- the node's class (may be null)cName
- the node's class namepublic void printRelations(ClassDoc c)
public void printExtraClasses(RootDoc root)
public void printInferredRelations(ClassDoc[] classes)
classes
- public void printInferredRelations(ClassDoc c)
classes
- public void printInferredDependencies(ClassDoc[] classes)
classes
- ClassDoc[] importedClasses(ClassDoc c)
public void printInferredDependencies(ClassDoc c)
classes
- private <T extends ProgramElementDoc> List<T> filterByVisibility(T[] docs, Visibility visibility)
private ClassGraph.FieldRelationInfo getFieldRelationInfo(FieldDoc field)
private String removeTemplate(String name)
public String classToUrl(ClassDoc cd, boolean rootClass)
protected static String buildRelativePath(String contextPackageName, String classPackageName)
public String classToUrl(String className)
private String mapApiDocRoot(String className)
public void prologue() throws IOException
IOException
public void epilogue()
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, String text)
private void tableLine(ClassGraph.Align align, String text, Options opt, ClassGraph.Font font)
private String fontWrap(String text, Options opt, ClassGraph.Font font)
opt
- text
- font
-