xjavadoc
Class AbstractClass

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

public abstract class AbstractClass
extends AbstractProgramElement
implements XClass

Base implementation of XClass.

Author:
Ara Abrahamian, Aslak Hellesøy

Constructor Summary
protected AbstractClass(AbstractClass containingClass, XTagFactory tagFactory)
           
protected AbstractClass(XJavaDoc xJavaDoc, XTagFactory tagFactory)
           
 
Method Summary
protected  void addInnerClass(XClass clazz)
           
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
           
 java.util.List getAllSubclasses()
          Returns the (known) subclasses, regardless of how deep in the class hierarchy.
 XConstructor getConstructor(java.lang.String constructorNameWithSignature)
          Gets the Constructor attribute of the AbstractClass object
 java.util.List getConstructors()
          Gets the constructors.
 XPackage getContainingPackage()
          Describe what the method does
 java.util.Collection getDeclaredInterfaces()
          Returns the interfaces that are declared in the source code.
 java.util.List getDirectSubclasses()
          Returns the (known) direct subclasses.
 java.util.List getExtendingInterfaces()
          Return the (known) interfaces that extend this interface.
 XField getField(java.lang.String fieldName)
          Returns an XField with the given name.
 java.util.List getFields()
          Describe what the method does
 java.util.List getFields(boolean superclasses)
           
 java.util.List getFields(Predicate predicate, boolean superclasses)
           
 java.util.List getImplementingClasses()
          Return the (known) classes that implement this interface.
 java.util.List getImportedClasses()
          Describe what the method does
 java.util.List getImportedPackages()
          Describe what the method does
 java.util.List getInnerClasses()
          Describe what the method does
 java.util.List getInterfaces()
          Returns all the implemented interfaces (if this is a class) or all the extended interfaces (if this is an interface)
 XMethod getMethod(java.lang.String methodNameWithSignature)
           
 XMethod getMethod(java.lang.String methodNameWithSignature, boolean superclasses)
          Returns an XMethod with the given name and parameters.
 java.util.List getMethods()
          Returns all the methods, not including superclasses
 java.util.List getMethods(boolean superclasses)
          Returns all the methods.
 java.util.List getMethods(Predicate predicate, boolean superclasses)
          Returns all the methods that are accepted by the filter.
 java.util.List getMethodTags(java.lang.String tagName, boolean superclasses)
          Returns a collection of tags from the methods in this class (or superclasses).
 java.lang.String getName()
          Get name
 java.lang.String getQualifiedName()
          Describe what the method does
 XClass getSuperclass()
          Describe what the method does
 XProgramElement getSuperElement()
          Describe what the method does
 java.util.List getSuperInterfaceElements()
           
 java.lang.String getTransformedName()
          Gets the transformed class name, for example: Character$Subset
 java.lang.String getTransformedQualifiedName()
          Gets the transformed qualified class name, for example: java.lang.Character$Subset
 java.lang.String getType()
          Gets the type, e.g.
 int hashCode()
           
protected  boolean hasImportedClasses()
           
protected  boolean hasImportedPackages()
           
protected  boolean hasInnerClasses()
           
 boolean isA(java.lang.String full_qualified_type_name)
          Returns true if we are subclass or implement the class/interface with the name classOrInterfaceName
 boolean isA(java.lang.String full_qualified_type_name, boolean superclasses)
          Returns true if we are subclass or implement the class/interface with the name classOrInterfaceName
 boolean isAnonymous()
          Returns true if this class is anonymous.
 boolean isImplementingInterface(java.lang.String full_qualified_type_name)
          Returns true if it implements full_qualified_type_name (or recursively superclasses implement).
 boolean isImplementingInterface(java.lang.String full_qualified_type_name, boolean superclasses)
          Returns true if it implements full_qualified_type_name (or recursively superclasses implement, if superclasses==true).
 boolean isInner()
          Returns true if this is an inner class.
 boolean isInterface()
          Gets the Interface attribute of the SourceClass object
 boolean isSubclassOf(java.lang.String full_qualified_type_name)
          Returns true if the superclass (or recursively superclass of superclass) is full_qualified_type_name.
 boolean isSubclassOf(java.lang.String full_qualified_type_name, boolean superclasses)
          Returns true if the superclass (or recursively superclass of superclass, if superclasses==true) is full_qualified_type_name.
 long lastModified()
           
 XClass qualify(java.lang.String unqualifiedClassName)
           
 java.lang.String save(java.io.File rootDir)
           
 java.lang.String toString()
           
 void updateDoc()
          update javadoc
 
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, isPrimitive, isWriteable, saveNeeded, setDirty
 
Methods inherited from interface xjavadoc.XProgramElement
getDoc, getModifiers, getModifierSpecifier, getXJavaDoc, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
 

Constructor Detail

AbstractClass

protected AbstractClass(AbstractClass containingClass,
                        XTagFactory tagFactory)

AbstractClass

protected AbstractClass(XJavaDoc xJavaDoc,
                        XTagFactory tagFactory)
Method Detail

isInterface

public final boolean isInterface()
Gets the Interface attribute of the SourceClass object

Specified by:
isInterface in interface XClass
Returns:
The Interface value

isA

public final boolean isA(java.lang.String full_qualified_type_name)
Description copied from interface: XClass
Returns true if we are subclass or implement the class/interface with the name classOrInterfaceName

Specified by:
isA in interface XClass
Parameters:
full_qualified_type_name - The full qualified type name
Returns:
true if of the specified type; false otherwise

isA

public final boolean isA(java.lang.String full_qualified_type_name,
                         boolean superclasses)
Description copied from interface: XClass
Returns true if we are subclass or implement the class/interface with the name classOrInterfaceName

Specified by:
isA in interface XClass
Parameters:
full_qualified_type_name - The full qualified type name
superclasses - whether the isA search should search the whole hierarchy
Returns:
true if of the specified type; false otherwise

getMethod

public final XMethod getMethod(java.lang.String methodNameWithSignature)
Specified by:
getMethod in interface XClass
Parameters:
methodNameWithSignature -
Returns:
The XMethod if found, otherwise null

getMethod

public final XMethod getMethod(java.lang.String methodNameWithSignature,
                               boolean superclasses)
Description copied from interface: XClass
Returns an XMethod with the given name and parameters. Example: getMethod("hello",new String[]{"java.lang.String","int"});

Specified by:
getMethod in interface XClass
Parameters:
methodNameWithSignature - Describe what the parameter does
superclasses - Looks in superclasses too if true
Returns:
The XMethod if found, otherwise null

getConstructor

public final XConstructor getConstructor(java.lang.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

getField

public final XField getField(java.lang.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

getImportedClasses

public final java.util.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 java.util.List getImportedPackages()
Describe what the method does

Specified by:
getImportedPackages in interface XClass
Returns:
Describe the return value for method for return value

getMethods

public final java.util.List getMethods()
Description copied from interface: XClass
Returns all the methods, not including superclasses

Specified by:
getMethods in interface XClass
Returns:
A collection of XMethod objects

getMethods

public final java.util.List getMethods(Predicate predicate,
                                       boolean superclasses)
Description copied from interface: XClass
Returns all the methods that are accepted by the filter.

Specified by:
getMethods in interface XClass
Parameters:
superclasses - if true, include methods from superclasses too.
predicate -
Returns:
A collection of XMethod objects

getFields

public final java.util.List getFields(Predicate predicate,
                                      boolean superclasses)

getMethods

public final java.util.List getMethods(boolean superclasses)
Description copied from interface: XClass
Returns all the methods.

Specified by:
getMethods in interface XClass
Parameters:
superclasses - if true, include methods from superclasses and interfaces too.
Returns:
A collection of XMethod objects

getFields

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

getFields

public final java.util.List getFields()
Describe what the method does

Specified by:
getFields in interface XClass
Returns:
Describe the return value for method for return value

getConstructors

public final java.util.List getConstructors()
Gets the constructors.

Specified by:
getConstructors in interface XClass
Returns:
the constructors.

isSubclassOf

public final boolean isSubclassOf(java.lang.String full_qualified_type_name)
Description copied from interface: XClass
Returns true if the superclass (or recursively superclass of superclass) is full_qualified_type_name.

Specified by:
isSubclassOf in interface XClass
Parameters:
full_qualified_type_name - Describe what the parameter does
Returns:
Describe the return value

isImplementingInterface

public final boolean isImplementingInterface(java.lang.String full_qualified_type_name)
Description copied from interface: XClass
Returns true if it implements full_qualified_type_name (or recursively superclasses implement).

Specified by:
isImplementingInterface in interface XClass
Parameters:
full_qualified_type_name - Describe what the parameter does
Returns:
Describe the return value

getType

public java.lang.String getType()
Description copied from interface: XClass
Gets the type, e.g. java.lang.String.class or java.lang.Integer.TYPE .

Specified by:
getType in interface XClass
Returns:
the qualified class name.

isInner

public boolean isInner()
Description copied from interface: XClass
Returns true if this is an inner class.

Specified by:
isInner in interface XClass
Returns:
true if this is an inner class.

isSubclassOf

public boolean isSubclassOf(java.lang.String full_qualified_type_name,
                            boolean superclasses)
Description copied from interface: XClass
Returns true if the superclass (or recursively superclass of superclass, if superclasses==true) is full_qualified_type_name.

Specified by:
isSubclassOf in interface XClass
Parameters:
full_qualified_type_name - Describe what the parameter does
superclasses - Looks in superclasses too if true
Returns:
Describe the return value

isImplementingInterface

public boolean isImplementingInterface(java.lang.String full_qualified_type_name,
                                       boolean superclasses)
Description copied from interface: XClass
Returns true if it implements full_qualified_type_name (or recursively superclasses implement, if superclasses==true).

Specified by:
isImplementingInterface in interface XClass
Parameters:
full_qualified_type_name - Describe what the parameter does
superclasses - Looks in superclasses too if true
Returns:
Describe the return value

getName

public java.lang.String getName()
Description copied from interface: Named
Get name

Specified by:
getName in interface Named
Returns:
name

getQualifiedName

public java.lang.String getQualifiedName()
Describe what the method does

Specified by:
getQualifiedName in interface XClass
Returns:
Describe the return value for method for return value

getTransformedName

public java.lang.String getTransformedName()
Gets the transformed class name, for example: Character$Subset

Specified by:
getTransformedName in interface XClass
Returns:
the transformed class name.

getTransformedQualifiedName

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

getInterfaces

public java.util.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

getDeclaredInterfaces

public java.util.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

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

getDirectSubclasses

public java.util.List getDirectSubclasses()
Description copied from interface: XClass
Returns the (known) direct subclasses. If this instance represents an interface, UnsupportedOperationException will be thrown. This can be avoided by testing with isInterface() prior to calling this method.

Specified by:
getDirectSubclasses in interface XClass
Returns:
the (known) subclasses

getAllSubclasses

public java.util.List getAllSubclasses()
Description copied from interface: XClass
Returns the (known) subclasses, regardless of how deep in the class hierarchy. If this instance represents an interface, UnsupportedOperationException will be thrown. This can be avoided by testing with isInterface() prior to calling this method.

Specified by:
getAllSubclasses in interface XClass
Returns:
the (known) subclasses

getImplementingClasses

public java.util.List getImplementingClasses()
Description copied from interface: XClass
Return the (known) classes that implement this interface. If this instance represents a class, an UnsupportedOperationException will be thrown. This can be avoided by testing with isInterface() prior to calling this method.

Specified by:
getImplementingClasses in interface XClass
Returns:
the (known) subinterfaces

getExtendingInterfaces

public java.util.List getExtendingInterfaces()
Description copied from interface: XClass
Return the (known) interfaces that extend this interface. If this instance represents a class, an UnsupportedOperationException will be thrown. This can be avoided by testing with isInterface() prior to calling this method.

Specified by:
getExtendingInterfaces in interface XClass
Returns:
the (known) extending interfaces

getContainingPackage

public XPackage getContainingPackage()
Describe what the method does

Specified by:
getContainingPackage in interface XClass
Overrides:
getContainingPackage in class AbstractProgramElement
Returns:
Describe the return value

getInnerClasses

public java.util.List getInnerClasses()
Describe what the method does

Specified by:
getInnerClasses in interface XClass
Returns:
Describe the return value

getSuperElement

public XProgramElement getSuperElement()
Describe what the method does

Specified by:
getSuperElement in interface XProgramElement
Returns:
Describe the return value

getSuperInterfaceElements

public java.util.List getSuperInterfaceElements()
Specified by:
getSuperInterfaceElements in interface XProgramElement

isAnonymous

public boolean isAnonymous()
Description copied from interface: XClass
Returns true if this class is anonymous.

Specified by:
isAnonymous in interface XClass
Returns:
true if this class is anonymous.

getMethodTags

public java.util.List getMethodTags(java.lang.String tagName,
                                    boolean superclasses)
Description copied from interface: XClass
Returns a collection of tags from the methods in this class (or superclasses).

Specified by:
getMethodTags in interface XClass
Parameters:
superclasses -
tagName -
Returns:
a List of XTag. If no tags are found, an empty List is returned.

compareTo

public final int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class AbstractProgramElement

toString

public final java.lang.String toString()

save

public java.lang.String save(java.io.File rootDir)
                      throws java.io.IOException
Specified by:
save in interface XClass
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

qualify

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

lastModified

public long lastModified()
Specified by:
lastModified in interface XClass
Returns:
the time that this class was last modified

updateDoc

public void updateDoc()
update javadoc

Specified by:
updateDoc in interface XProgramElement
Overrides:
updateDoc in class AbstractProgramElement

hasImportedClasses

protected final boolean hasImportedClasses()

hasInnerClasses

protected final boolean hasInnerClasses()

hasImportedPackages

protected final boolean hasImportedPackages()

addInnerClass

protected void addInnerClass(XClass clazz)


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