This class represents a class for which the source code is available
XJavaDocFil
_compilationUnit
private SimpleNode _compilationUnit
The root node of the AST
_dirty
private boolean _dirty
doe we nees saving?
_isExtraClass
private final boolean _isExtraClass
_qualifiedClasses
private final Map _qualifiedClasses
_sourceFile
private AbstractFile _sourceFile
Keep a ref to the file in case of warning reporting
_tagsForValidation
private final List _tagsForValidation
instanceCount
public static int instanceCount
SourceClass
public SourceClass(SourceClass mainClass,
int dummy,
XTagFactory tagFactory)
Constructor to use for "extra" classes, that is, secondary classes that
figure in the same source.
mainClass
- The containing class. Or rather the "main" class in the
source.dummy
-
SourceClass
public SourceClass(SourceClass containingClass,
XTagFactory tagFactory)
Constructor to use for inner classes.
containingClass
- The containing class;
SourceClass
public SourceClass(XJavaDoc xJavaDoc,
File sourceFile,
boolean useNodeParser,
XTagFactory tagFactory)
sourceFile
- useNodeParser
-
SourceClass
public SourceClass(XJavaDoc xJavaDoc,
File sourceFile,
XTagFactory tagFactory)
Constructor to use for outer classes
sourceFile
- The file containing the source
SourceClass
public SourceClass(XJavaDoc xJavaDoc,
Reader sourceFile,
XTagFactory tagFactory)
Constructor to use for outer classes
sourceFile
- The file containing the source
SourceClass
public SourceClass(XJavaDoc xJavaDoc,
AbstractFile sourceFile,
boolean useNodeParser,
XTagFactory tagFactory,
String encoding)
Constructor to use for outer classes
sourceFile
- The file containing the sourceuseNodeParser
-
addTagForValidation
public void addTagForValidation(DefaultXTag tag)
getCompilationUnit
public SimpleNode getCompilationUnit()
getFileName
public static String getFileName(String qualifiedName)
Describe what the method does
qualifiedName
- Describe what the parameter does
- Describe the return value
getNextAnonymousClassName
public String getNextAnonymousClassName()
Returns "1", "2", etc., depending on how many inner classes we have.
- String containing number of next anonymous inner class
getReader
public Reader getReader()
Returns a reader for the source code.
- a reader for the source code.
isExtraClass
public boolean isExtraClass()
isOuterClass
private boolean isOuterClass()
Gets the OuterClass attribute of the SourceClass object
isPrimitive
public boolean isPrimitive()
Returns true if this class is a primitive. That is, one of the following:
- boolean
- byte
- char
- double
- float
- int
- long
- short
- java.lang.Boolean
- java.lang.Byte
- java.lang.Character
- java.lang.Double
- java.lang.Float
- java.lang.Integer
- java.lang.Long
- java.lang.Short
- java.lang.String
- isPrimitive in interface XClass
isWriteable
public boolean isWriteable()
Gets the Writeable attribute of the SourceClass object
- isWriteable in interface XClass
parse
private void parse(boolean useNodeParser)
Describe what the method does
useNodeParser
- Describe what the parameter does
print
public void print(Writer out)
Prints this class to a stream
out
- Describe what the parameter does
qualify
public XClass qualify(String unqualifiedClassName)
Returns fully qualified name of a class. 1: check for "." 2: if "." it's
already qualified 3: if no ".", must try with all imported packages or
classes
- qualify in interface XClass
- qualify in interface AbstractClass
unqualifiedClassName
- Describe what the parameter does
- Describe the return value
save
public String save(File rootDir)
throws IOException
Saves the class at root dir rootDir. The actual java file is derived from
tha package name. If no root dir is specified, save where it was loaded from
- save in interface XClass
- save in interface AbstractClass
rootDir
- the root directory.
- the relative fileName to which the file was saved.
saveNeeded
public boolean saveNeeded()
whether class needs saving
- saveNeeded in interface XClass
setCompilationUnit
public void setCompilationUnit(SimpleNode compilationUnit)
Called by JavaParser at the end of the parsing
compilationUnit
- The new CompilationUnit value
setDirty
public void setDirty()
say this class is dirty and needs saving propagate to outer class ( if any )
- setDirty in interface XClass
unqualifiedNameInImportedClasses
private final String unqualifiedNameInImportedClasses(String unqualifiedClassName)
unqualifiedNameInImportedClassesInnerClasses
private final XClass unqualifiedNameInImportedClassesInnerClasses(String unqualifiedClassName)
unqualifiedNameInImportedPackages
private final String unqualifiedNameInImportedPackages(String unqualifiedClassName)
Describe what the method does
unqualifiedClassName
- Describe what the parameter does
- Describe the return value
unqualifiedNameInInnerClasses
private final String unqualifiedNameInInnerClasses(String unqualifiedClassName)
Describe what the method does
unqualifiedClassName
- Describe what the parameter does
- Describe the return value
unqualifiedNameInInnerClassesOfSuperClass
private final String unqualifiedNameInInnerClassesOfSuperClass(String unqualifiedClassName)
Resolves Inner classes that exist in the super class hierarchy.
unqualifiedClassName
- Name of the class to resolve
- The qualified name of the inner class.
unqualifiedNameInInnerInterface
private final String unqualifiedNameInInnerInterface(String unqualifiedClassName)
Resolves Inner interfaces that exist in current class.
This catches inner classes as well because isInterface()
does not indicate if it's an interface.
unqualifiedClassName
- Name of the class to resolve
- The qualified name of the inner class.
unqualifiedNameInJavaDotLang
private final String unqualifiedNameInJavaDotLang(String unqualifiedClassName)
Returns the fully qualified class name if it's found in java.lang, otherwise
null.
- fully qualified class name, or null
unqualifiedNameInTheSameClassAsAnInnerClass
private final String unqualifiedNameInTheSameClassAsAnInnerClass(String unqualifiedClassName)
unqualifiedNameInTheSamePackage
private final String unqualifiedNameInTheSamePackage(String unqualifiedClassName)
Describe what the method does
unqualifiedClassName
- Describe what the parameter does
- Describe the return value
validateTags
public void validateTags()
throws TagValidationException
Called by XJavaDoc after the entire source is parsed, but only if validation
is on.