xjavadoc
Class SourceClass

java.lang.Object
  extended byxjavadoc.AbstractProgramElement
      extended byxjavadoc.AbstractClass
          extended byxjavadoc.SourceClass
All Implemented Interfaces:
java.lang.Comparable, Named, XClass, XProgramElement, XType

public final class SourceClass
extends AbstractClass

This class represents a class for which the source code is available XJavaDocFil

Author:
Aslak Hellesøy

Field Summary
static int instanceCount
           
 
Constructor Summary
SourceClass(SourceClass mainClass, int dummy, XTagFactory tagFactory)
          Constructor to use for "extra" classes, that is, secondary classes that figure in the same source.
SourceClass(SourceClass containingClass, XTagFactory tagFactory)
          Constructor to use for inner classes.
SourceClass(XJavaDoc xJavaDoc, AbstractFile sourceFile, boolean useNodeParser, XTagFactory tagFactory, java.lang.String encoding)
          Constructor to use for outer classes
SourceClass(XJavaDoc xJavaDoc, java.io.File sourceFile, boolean useNodeParser, XTagFactory tagFactory)
           
SourceClass(XJavaDoc xJavaDoc, java.io.File sourceFile, XTagFactory tagFactory)
          Constructor to use for outer classes
SourceClass(XJavaDoc xJavaDoc, java.io.Reader sourceFile, XTagFactory tagFactory)
          Constructor to use for outer classes
 
Method Summary
 void addTagForValidation(DefaultXTag tag)
           
 SimpleNode getCompilationUnit()
           
 AbstractFile getFile()
           
static java.lang.String getFileName(java.lang.String qualifiedName)
          Describe what the method does
 java.lang.String getNextAnonymousClassName()
          Returns "1", "2", etc., depending on how many inner classes we have.
 java.io.Reader getReader()
          Returns a reader for the source code.
 boolean isExtraClass()
           
 boolean isPrimitive()
          Returns true if this class is a primitive.
 boolean isWriteable()
          Gets the Writeable attribute of the SourceClass object
 long lastModified()
          Describe what the method does
 void print(java.io.OutputStream out)
          Deprecated. use the Writer method
 void print(java.io.Writer out)
          Prints this class to a stream
 XClass qualify(java.lang.String unqualifiedClassName)
          Returns fully qualified name of a class.
 void reset()
           
 java.lang.String save(java.io.File rootDir)
          Saves the class at root dir rootDir.
 boolean saveNeeded()
          whether class needs saving
 void setCompilationUnit(SimpleNode compilationUnit)
          Called by JavaParser at the end of the parsing
 void setDirty()
          say this class is dirty and needs saving propagate to outer class ( if any )
 void validateTags()
          Called by XJavaDoc after the entire source is parsed, but only if validation is on.
 
Methods inherited from class xjavadoc.AbstractClass
addInnerClass, compareTo, equals, getAllSubclasses, getConstructor, getConstructors, getContainingPackage, getDeclaredInterfaces, getDirectSubclasses, getExtendingInterfaces, getField, getFields, getFields, getFields, getImplementingClasses, getImportedClasses, getImportedPackages, getInnerClasses, getInterfaces, getMethod, getMethod, getMethods, getMethods, getMethods, getMethodTags, getName, getQualifiedName, getSuperclass, getSuperElement, getSuperInterfaceElements, getTransformedName, getTransformedQualifiedName, getType, hashCode, hasImportedClasses, hasImportedPackages, hasInnerClasses, isA, isA, isAnonymous, isImplementingInterface, isImplementingInterface, isInner, isInterface, isSubclassOf, isSubclassOf, toString, updateDoc
 
Methods inherited from class xjavadoc.AbstractProgramElement
addModifier, getContainingAbstractClass, getContainingClass, getDoc, getModifiers, getModifierSpecifier, getTagFactory, getXJavaDoc, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, setToken
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface xjavadoc.XClass
getContainingClass, isAbstract
 
Methods inherited from interface xjavadoc.XProgramElement
getDoc, getModifiers, getModifierSpecifier, getXJavaDoc, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
 

Field Detail

instanceCount

public static int instanceCount
Constructor Detail

SourceClass

public SourceClass(SourceClass containingClass,
                   XTagFactory tagFactory)
Constructor to use for inner classes.

Parameters:
containingClass - The containing class;

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.

Parameters:
mainClass - The containing class. Or rather the "main" class in the source.
dummy -

SourceClass

public SourceClass(XJavaDoc xJavaDoc,
                   java.io.File sourceFile,
                   XTagFactory tagFactory)
Constructor to use for outer classes

Parameters:
sourceFile - The file containing the source

SourceClass

public SourceClass(XJavaDoc xJavaDoc,
                   java.io.Reader sourceFile,
                   XTagFactory tagFactory)
Constructor to use for outer classes

Parameters:
sourceFile - The file containing the source

SourceClass

public SourceClass(XJavaDoc xJavaDoc,
                   java.io.File sourceFile,
                   boolean useNodeParser,
                   XTagFactory tagFactory)
Parameters:
sourceFile -
useNodeParser -

SourceClass

public SourceClass(XJavaDoc xJavaDoc,
                   AbstractFile sourceFile,
                   boolean useNodeParser,
                   XTagFactory tagFactory,
                   java.lang.String encoding)
Constructor to use for outer classes

Parameters:
sourceFile - The file containing the source
useNodeParser -
Method Detail

getFileName

public static java.lang.String getFileName(java.lang.String qualifiedName)
Describe what the method does

Parameters:
qualifiedName - Describe what the parameter does
Returns:
Describe the return value

isExtraClass

public boolean isExtraClass()

getNextAnonymousClassName

public java.lang.String getNextAnonymousClassName()
Returns "1", "2", etc., depending on how many inner classes we have.

Returns:
String containing number of next anonymous inner class

isWriteable

public boolean isWriteable()
Gets the Writeable attribute of the SourceClass object

Returns:
The Writeable value

getCompilationUnit

public SimpleNode getCompilationUnit()

getReader

public java.io.Reader getReader()
Returns a reader for the source code.

Returns:
a reader for the source code.

getFile

public AbstractFile getFile()

isPrimitive

public boolean isPrimitive()
Description copied from interface: XClass
Returns true if this class is a primitive. That is, one of the following:

Returns:
true if a primitive

setDirty

public void setDirty()
say this class is dirty and needs saving propagate to outer class ( if any )


setCompilationUnit

public void setCompilationUnit(SimpleNode compilationUnit)
Called by JavaParser at the end of the parsing

Parameters:
compilationUnit - The new CompilationUnit value

validateTags

public void validateTags()
                  throws TagValidationException
Called by XJavaDoc after the entire source is parsed, but only if validation is on.

Throws:
TagValidationException

addTagForValidation

public void addTagForValidation(DefaultXTag tag)

saveNeeded

public boolean saveNeeded()
Description copied from interface: XClass
whether class needs saving

Returns:
true if save needed

lastModified

public long lastModified()
Describe what the method does

Specified by:
lastModified in interface XClass
Overrides:
lastModified in class AbstractClass
Returns:
Describe the return value

print

public void print(java.io.OutputStream out)
Deprecated. use the Writer method

Parameters:
out -

print

public void print(java.io.Writer out)
Prints this class to a stream

Parameters:
out - Describe what the parameter does

save

public java.lang.String save(java.io.File rootDir)
                      throws java.io.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

Specified by:
save in interface XClass
Overrides:
save in class AbstractClass
Parameters:
rootDir - the root directory.
Returns:
the relative fileName to which the file was saved.
Throws:
java.io.IOException - if the file couldn't be saved

qualify

public XClass qualify(java.lang.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

Specified by:
qualify in interface XClass
Overrides:
qualify in class AbstractClass
Parameters:
unqualifiedClassName - Describe what the parameter does
Returns:
Describe the return value

reset

public void reset()


Copyright © 2002-2004 XDoclet Team. All Rights Reserved.