xjavadoc

Class AbstractClass

Implemented Interfaces:
Comparable, Named, XClass, XProgramElement, XType
Known Direct Subclasses:
BinaryClass, Primitive, SourceClass, UnknownClass

public abstract class AbstractClass
extends AbstractProgramElement
implements XClass

Base implementation of XClass.

Authors:
Ara Abrahamian
Aslak Helles?y

Field Summary

private List
_allInterfaces
The implemented interfaces according to the hierarchy
private List
_allSubclasses
private List
_constructors
private XPackage
_containingPackage
private List
_declaredInterfaces
The implemented interfaces according to the source
private List
_directSubclasses
private List
_extendingInterfaces
private List
_fields
private int
_hash
private List
_implementingClasses
private List
_importedClassNames
private List
_importedClasses
private List
_importedPackages
private List
_innerClasses
private boolean
_isAnonymous
private boolean
_isInterface
private List
_methods
private String
_name
private Map
_namedConstructors
private HashMap
_namedMethods
private String
_qualifiedName
private XClass
_superclass
private String
_transformedName
private String
_transformedQualifiedName

Fields inherited from class xjavadoc.AbstractProgramElement

EMPTY_LIST, _containingClass, _doc, _javadocToken, _modifierString, _modifiers, _tagFactory, _token, _xJavaDoc

Constructor Summary

AbstractClass(AbstractClass containingClass, XTagFactory tagFactory)
AbstractClass(XJavaDoc xJavaDoc, XTagFactory tagFactory)

Method Summary

(package private) void
addConstructor(XConstructor constructor)
Gets the Constructors attribute of the AbstractClass object
(package private) void
addField(XField field)
Gets the Fields attribute of the AbstractClass object
(package private) void
addImportedClass(String importedClass)
Sets the ImportedClasses attribute of the AbstractClass object
(package private) void
addImportedPackage(String importedPackage)
Sets the ImportedPackages attribute of the AbstractClass object
protected void
addInnerClass(XClass clazz)
(package private) void
addInterface(String interfaceName)
Adds an interface that this class implements (if this is a class) or an interface that this interface extends (if this is an interface)
(package private) void
addMethod(XMethod method)
Gets the Methods attribute of the AbstractClass object
int
compareTo(Object o)
boolean
equals(Object obj)
List
getAllSubclasses()
XConstructor
getConstructor(String constructorNameWithSignature)
Gets the Constructor attribute of the AbstractClass object
List
getConstructors()
Gets the constructors.
XPackage
getContainingPackage()
Describe what the method does
Collection
getDeclaredInterfaces()
Returns the interfaces that are declared in the source code.
List
getDirectSubclasses()
List
getExtendingInterfaces()
XField
getField(String fieldName)
Returns an XField with the given name.
List
getFields()
Describe what the method does
List
getFields(Predicate predicate, boolean superclasses)
List
getFields(boolean superclasses)
List
getImplementingClasses()
List
getImportedClasses()
Describe what the method does
List
getImportedPackages()
Describe what the method does
List
getInnerClasses()
Describe what the method does
List
getInterfaces()
Returns all the implemented interfaces (if this is a class) or all the extended interfaces (if this is an interface)
private List
getMembers(boolean superclasses, boolean forFields)
Returns all the fields or methods.
XMethod
getMethod(String methodNameWithSignature)
XMethod
getMethod(String methodNameWithSignature, boolean superclasses)
List
getMethodTags(String tagName, boolean superclasses)
List
getMethods()
List
getMethods(Predicate predicate, boolean superclasses)
List
getMethods(boolean superclasses)
String
getName()
String
getQualifiedName()
Describe what the method does
XProgramElement
getSuperElement()
Describe what the method does
List
getSuperInterfaceElements()
XClass
getSuperclass()
Describe what the method does
String
getTransformedName()
Gets the transformed class name, for example: Character$Subset
String
getTransformedQualifiedName()
Gets the transformed qualified class name, for example: java.lang.Character$Subset
String
getType()
protected boolean
hasImportedClasses()
protected boolean
hasImportedPackages()
protected boolean
hasInnerClasses()
int
hashCode()
private void
initializeNamedConstructorsHashMap()
private void
initializeNamedMethodsHashMap()
boolean
isA(String full_qualified_type_name)
boolean
isA(String full_qualified_type_name, boolean superclasses)
boolean
isAnonymous()
boolean
isImplementingInterface(String full_qualified_type_name)
boolean
isImplementingInterface(String full_qualified_type_name, boolean superclasses)
boolean
isInner()
boolean
isInterface()
Gets the Interface attribute of the SourceClass object
boolean
isSubclassOf(String full_qualified_type_name)
boolean
isSubclassOf(String full_qualified_type_name, boolean superclasses)
long
lastModified()
XClass
qualify(String unqualifiedClassName)
(package private) void
reset()
(package private) void
resolveImportedClasses()
String
save(File rootDir)
(package private) void
setContainingPackage(String containingPackage)
Sets the ContainingPackage attribute of the AbstractProgramElement object Use package name specified in class, and do not complain about directory struct.
(package private) void
setInterface(boolean flag)
Sets the Interface attribute of the SourceClass object
(package private) void
setName(String name)
Sets the unqualified name of the class.
(package private) void
setQualifiedName(String qualifiedName)
Sets the qualified name of the class.
(package private) void
setRealised(String clazz)
This method is called for anonymous classes only.
(package private) void
setSuperclass(String superclass)
Sets the SuperClass attribute of the SourceClass object
String
toString()
void
updateDoc()
update javadoc
private void
validate(XMember member)

Methods inherited from class xjavadoc.AbstractProgramElement

addModifier, compareTo, getContainingAbstractClass, getContainingClass, getContainingPackage, getDoc, getModifierSpecifier, getModifiers, getTagFactory, getXJavaDoc, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, reset, setJavaDoc, setToken, updateDoc

Field Details

_allInterfaces

private List _allInterfaces
The implemented interfaces according to the hierarchy


_allSubclasses

private List _allSubclasses


_constructors

private List _constructors


_containingPackage

private XPackage _containingPackage


_declaredInterfaces

private List _declaredInterfaces
The implemented interfaces according to the source


_directSubclasses

private List _directSubclasses


_extendingInterfaces

private List _extendingInterfaces


_fields

private List _fields


_hash

private int _hash


_implementingClasses

private List _implementingClasses


_importedClassNames

private List _importedClassNames


_importedClasses

private List _importedClasses


_importedPackages

private List _importedPackages


_innerClasses

private List _innerClasses


_isAnonymous

private boolean _isAnonymous


_isInterface

private boolean _isInterface


_methods

private List _methods


_name

private String _name


_namedConstructors

private Map _namedConstructors


_namedMethods

private HashMap _namedMethods


_qualifiedName

private String _qualifiedName


_superclass

private XClass _superclass


_transformedName

private String _transformedName


_transformedQualifiedName

private String _transformedQualifiedName

Constructor Details

AbstractClass

protected AbstractClass(AbstractClass containingClass,
                        XTagFactory tagFactory)


AbstractClass

protected AbstractClass(XJavaDoc xJavaDoc,
                        XTagFactory tagFactory)

Method Details

addConstructor

(package private)  void addConstructor(XConstructor constructor)
Gets the Constructors attribute of the AbstractClass object

Parameters:
constructor - Describe the method parameter


addField

(package private)  void addField(XField field)
Gets the Fields attribute of the AbstractClass object

Parameters:
field - Describe the method parameter


addImportedClass

(package private)  void addImportedClass(String importedClass)
Sets the ImportedClasses attribute of the AbstractClass object

Parameters:
importedClass - Describe the method parameter


addImportedPackage

(package private)  void addImportedPackage(String importedPackage)
Sets the ImportedPackages attribute of the AbstractClass object

Parameters:
importedPackage - Describe the method parameter


addInnerClass

protected void addInnerClass(XClass clazz)


addInterface

(package private) final void addInterface(String interfaceName)
Adds an interface that this class implements (if this is a class) or an interface that this interface extends (if this is an interface)

Parameters:
interfaceName - Describe the method parameter


addMethod

(package private)  void addMethod(XMethod method)
Gets the Methods attribute of the AbstractClass object

Parameters:
method - Describe the method parameter


compareTo

public final int compareTo(Object o)
Overrides:
compareTo in interface AbstractProgramElement


equals

public boolean equals(Object obj)


getAllSubclasses

public List getAllSubclasses()
Specified by:
getAllSubclasses in interface XClass


getConstructor

public final XConstructor getConstructor(String constructorNameWithSignature)
Gets the Constructor attribute of the AbstractClass object
Specified by:
getConstructor in interface XClass

Parameters:
constructorNameWithSignature - Describe what the parameter does

Returns:
The Constructor value


getConstructors

public final List getConstructors()
Gets the constructors.
Specified by:
getConstructors in interface XClass

Returns:
the constructors.


getContainingPackage

public XPackage getContainingPackage()
Describe what the method does
Specified by:
getContainingPackage in interface XClass
getContainingPackage in interface XProgramElement
Overrides:
getContainingPackage in interface AbstractProgramElement

Returns:
Describe the return value


getDeclaredInterfaces

public Collection getDeclaredInterfaces()
Returns the interfaces that are declared in the source code. This excludes any interfaces that might be implicitly implemented. This method is only useful for CodeUnit, which compares source codes, and should normally not be called.

Returns:
A Collection of XClass


getDirectSubclasses

public List getDirectSubclasses()
Specified by:
getDirectSubclasses in interface XClass


getExtendingInterfaces

public List getExtendingInterfaces()
Specified by:
getExtendingInterfaces in interface XClass


getField

public final XField getField(String fieldName)
Returns an XField with the given name. Example: getField("id");
Specified by:
getField in interface XClass

Parameters:
fieldName - Describe what the parameter does

Returns:
The Field value


getFields

public final List getFields()
Describe what the method does
Specified by:
getFields in interface XClass

Returns:
Describe the return value for method for return value


getFields

public final List getFields(Predicate predicate,
                            boolean superclasses)


getFields

public final List getFields(boolean superclasses)
Specified by:
getFields in interface XClass


getImplementingClasses

public List getImplementingClasses()
Specified by:
getImplementingClasses in interface XClass


getImportedClasses

public final List getImportedClasses()
Describe what the method does
Specified by:
getImportedClasses in interface XClass

Returns:
Describe the return value for method for return value


getImportedPackages

public final List getImportedPackages()
Describe what the method does
Specified by:
getImportedPackages in interface XClass

Returns:
Describe the return value for method for return value


getInnerClasses

public List getInnerClasses()
Describe what the method does
Specified by:
getInnerClasses in interface XClass

Returns:
Describe the return value


getInterfaces

public List getInterfaces()
Returns all the implemented interfaces (if this is a class) or all the extended interfaces (if this is an interface)
Specified by:
getInterfaces in interface XClass

Returns:
Describe the return value for method for return value


getMembers

private final List getMembers(boolean superclasses,
                              boolean forFields)
Returns all the fields or methods.

Parameters:
superclasses -
forFields - true if you want the fields, false if you want methods

Returns:
A List of XMember


getMethod

public final XMethod getMethod(String methodNameWithSignature)
Specified by:
getMethod in interface XClass


getMethod

public final XMethod getMethod(String methodNameWithSignature,
                               boolean superclasses)
Specified by:
getMethod in interface XClass


getMethodTags

public List getMethodTags(String tagName,
                          boolean superclasses)
Specified by:
getMethodTags in interface XClass


getMethods

public final List getMethods()
Specified by:
getMethods in interface XClass


getMethods

public final List getMethods(Predicate predicate,
                             boolean superclasses)
Specified by:
getMethods in interface XClass


getMethods

public final List getMethods(boolean superclasses)
Specified by:
getMethods in interface XClass


getName

public String getName()
Specified by:
getName in interface Named


getQualifiedName

public String getQualifiedName()
Describe what the method does
Specified by:
getQualifiedName in interface XClass

Returns:
Describe the return value for method for return value


getSuperElement

public XProgramElement getSuperElement()
Describe what the method does
Specified by:
getSuperElement in interface XProgramElement

Returns:
Describe the return value


getSuperInterfaceElements

public List getSuperInterfaceElements()
Specified by:
getSuperInterfaceElements in interface XProgramElement


getSuperclass

public XClass getSuperclass()
Describe what the method does
Specified by:
getSuperclass in interface XClass

Returns:
Describe the return value for method for return value


getTransformedName

public String getTransformedName()
Gets the transformed class name, for example: Character$Subset
Specified by:
getTransformedName in interface XClass

Returns:
the transformed class name.


getTransformedQualifiedName

public String getTransformedQualifiedName()
Gets the transformed qualified class name, for example: java.lang.Character$Subset
Specified by:
getTransformedQualifiedName in interface XClass

Returns:
the transformed qualified class name.


getType

public String getType()
Specified by:
getType in interface XClass


hasImportedClasses

protected final boolean hasImportedClasses()


hasImportedPackages

protected final boolean hasImportedPackages()


hasInnerClasses

protected final boolean hasInnerClasses()


hashCode

public int hashCode()


initializeNamedConstructorsHashMap

private void initializeNamedConstructorsHashMap()


initializeNamedMethodsHashMap

private void initializeNamedMethodsHashMap()


isA

public final boolean isA(String full_qualified_type_name)
Specified by:
isA in interface XClass


isA

public final boolean isA(String full_qualified_type_name,
                         boolean superclasses)
Specified by:
isA in interface XClass


isAnonymous

public boolean isAnonymous()
Specified by:
isAnonymous in interface XClass


isImplementingInterface

public final boolean isImplementingInterface(String full_qualified_type_name)
Specified by:
isImplementingInterface in interface XClass


isImplementingInterface

public boolean isImplementingInterface(String full_qualified_type_name,
                                       boolean superclasses)
Specified by:
isImplementingInterface in interface XClass


isInner

public boolean isInner()
Specified by:
isInner in interface XClass


isInterface

public final boolean isInterface()
Gets the Interface attribute of the SourceClass object
Specified by:
isInterface in interface XClass

Returns:
The Interface value


isSubclassOf

public final boolean isSubclassOf(String full_qualified_type_name)
Specified by:
isSubclassOf in interface XClass


isSubclassOf

public boolean isSubclassOf(String full_qualified_type_name,
                            boolean superclasses)
Specified by:
isSubclassOf in interface XClass


lastModified

public long lastModified()
Specified by:
lastModified in interface XClass


qualify

public XClass qualify(String unqualifiedClassName)
Specified by:
qualify in interface XClass


reset

(package private)  void reset()
Overrides:
reset in interface AbstractProgramElement


resolveImportedClasses

(package private)  void resolveImportedClasses()


save

public String save(File rootDir)
            throws IOException
Specified by:
save in interface XClass


setContainingPackage

(package private) final void setContainingPackage(String containingPackage)
Sets the ContainingPackage attribute of the AbstractProgramElement object Use package name specified in class, and do not complain about directory struct.

Parameters:
containingPackage - The new ContainingPackage value


setInterface

(package private) final void setInterface(boolean flag)
Sets the Interface attribute of the SourceClass object

Parameters:
flag - The new Interface value


setName

(package private)  void setName(String name)
Sets the unqualified name of the class. Should only be called on objects that represent inner classes.

Parameters:
name - The new Name value


setQualifiedName

(package private) final void setQualifiedName(String qualifiedName)
Sets the qualified name of the class. Should only be called on objects that represent outer classes.

Parameters:
qualifiedName - The new QualifiedName value


setRealised

(package private) final void setRealised(String clazz)
This method is called for anonymous classes only. Anon classes come in 2 flavours. They either realise a class or an interface.

Parameters:
clazz -


setSuperclass

(package private) final void setSuperclass(String superclass)
Sets the SuperClass attribute of the SourceClass object

Parameters:
superclass - The new Superclass value


toString

public final String toString()


updateDoc

public void updateDoc()
update javadoc
Specified by:
updateDoc in interface XProgramElement
Overrides:
updateDoc in interface AbstractProgramElement


validate

private final void validate(XMember member)
            throws IllegalStateException