xjavadoc
Interface XClass

All Superinterfaces:
java.lang.Comparable, Named, XProgramElement, XType
All Known Implementing Classes:
AbstractClass

public interface XClass
extends XType

This class represents any type: source class, binary class or primitive type.

Author:
Aslak Hellesøy

Method Summary
 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 with the given signature.
 java.util.List getConstructors()
           
 XClass getContainingClass()
          Returns the containing class, if this is an inner class.
 XPackage getContainingPackage()
          Returns the package this class lives in.
 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 name)
           
 java.util.List getFields()
           
 java.util.List getFields(boolean superclasses)
           
 java.util.List getImplementingClasses()
          Return the (known) classes that implement this interface.
 java.util.List getImportedClasses()
          Returns the imported classes.
 java.util.List getImportedPackages()
           
 java.util.List getInnerClasses()
          Returns the inner classes.
 java.util.List getInterfaces()
          Returns all the interfaces implemented by this class.
 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 getQualifiedName()
          Gets the qualified class name.
 XClass getSuperclass()
          Return superclass of this class.
 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.
 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 superclases)
          Returns true if we are subclass or implement the class/interface with the name classOrInterfaceName
 boolean isAbstract()
           
 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()
           
 boolean isPrimitive()
          Returns true if this class is a primitive.
 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.
 boolean isWriteable()
          Returns true if this instance can be saved.
 long lastModified()
           
 XClass qualify(java.lang.String unqualifiedClassName)
           
 java.lang.String save(java.io.File rootDir)
           
 boolean saveNeeded()
          whether class needs saving
 void setDirty()
          mark this class dirty for saving
 
Methods inherited from interface xjavadoc.XProgramElement
getDoc, getModifiers, getModifierSpecifier, getSuperElement, getSuperInterfaceElements, getXJavaDoc, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, updateDoc
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface xjavadoc.Named
getName
 

Method Detail

isInner

public boolean isInner()
Returns true if this is an inner class.

Returns:
true if this is an inner class.

getContainingClass

public XClass getContainingClass()
Returns the containing class, if this is an inner class.

Specified by:
getContainingClass in interface XProgramElement
Returns:
the containing class.

isPrimitive

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

Returns:
true if a primitive

isAnonymous

public boolean isAnonymous()
Returns true if this class is anonymous.

Returns:
true if this class is anonymous.

getQualifiedName

public java.lang.String getQualifiedName()
Gets the qualified class name.

Returns:
the qualified class name.

getTransformedName

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

Returns:
the transformed class name.

getTransformedQualifiedName

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

Returns:
the transformed qualified class name.

getType

public java.lang.String getType()
Gets the type, e.g. java.lang.String.class or java.lang.Integer.TYPE .

Returns:
the qualified class name.

getConstructor

public XConstructor getConstructor(java.lang.String constructorNameWithSignature)
Gets the constructor with the given signature.

Parameters:
constructorNameWithSignature - the signature of the constructor, e.g. Foo(int,java.lang.String)>/code>.
Returns:
the constructor.

getField

public XField getField(java.lang.String name)

isAbstract

public boolean isAbstract()
Specified by:
isAbstract in interface XProgramElement

isA

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

Parameters:
full_qualified_type_name - The full qualified type name
Returns:
true if of the specified type; false otherwise

isA

public boolean isA(java.lang.String full_qualified_type_name,
                   boolean superclases)
Returns true if we are subclass or implement the class/interface with the name classOrInterfaceName

Parameters:
full_qualified_type_name - The full qualified type name
superclases - whether the isA search should search the whole hierarchy
Returns:
true if of the specified type; false otherwise

getSuperclass

public XClass getSuperclass()
Return superclass of this class. If this class represents an interface, null will be returned.

Returns:
superclass of this class

getDirectSubclasses

public java.util.List getDirectSubclasses()
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.

Returns:
the (known) subclasses

getAllSubclasses

public java.util.List getAllSubclasses()
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.

Returns:
the (known) subclasses

getImplementingClasses

public java.util.List getImplementingClasses()
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.

Returns:
the (known) subinterfaces

getExtendingInterfaces

public java.util.List getExtendingInterfaces()
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.

Returns:
the (known) extending interfaces

getInterfaces

public java.util.List getInterfaces()
Returns all the interfaces implemented by this class. If this class represents an interface, it will return all the interfaces that this interface extends.

Returns:
a Collection of XClass.

getMethod

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

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

getMethod

public XMethod getMethod(java.lang.String methodNameWithSignature)
Parameters:
methodNameWithSignature -
Returns:
The XMethod if found, otherwise null

save

public java.lang.String save(java.io.File rootDir)
                      throws java.io.IOException
Throws:
java.io.IOException

getContainingPackage

public XPackage getContainingPackage()
Returns the package this class lives in.

Specified by:
getContainingPackage in interface XProgramElement
Returns:
the package this class lives in.

getImportedClasses

public java.util.List getImportedClasses()
Returns the imported classes.

Returns:
a Collection of XClass.

getInnerClasses

public java.util.List getInnerClasses()
Returns the inner classes.

Returns:
a Collection of XClass.

getMethods

public java.util.List getMethods(boolean superclasses)
Returns all the methods.

Parameters:
superclasses - if true, include methods from superclasses and interfaces too.
Returns:
A collection of XMethod objects

getMethods

public java.util.List getMethods(Predicate predicate,
                                 boolean superclasses)
Returns all the methods that are accepted by the filter.

Parameters:
superclasses - if true, include methods from superclasses too.
predicate -
Returns:
A collection of XMethod objects

getMethods

public java.util.List getMethods()
Returns all the methods, not including superclasses

Returns:
A collection of XMethod objects

getFields

public java.util.List getFields()

getFields

public java.util.List getFields(boolean superclasses)

getConstructors

public java.util.List getConstructors()

getImportedPackages

public java.util.List getImportedPackages()

isSubclassOf

public boolean isSubclassOf(java.lang.String full_qualified_type_name)
Returns true if the superclass (or recursively superclass of superclass) is full_qualified_type_name.

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

isSubclassOf

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

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)
Returns true if it implements full_qualified_type_name (or recursively superclasses implement).

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

isImplementingInterface

public 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).

Parameters:
full_qualified_type_name - Describe what the parameter does
superclasses - Looks in superclasses too if true
Returns:
Describe the return value

isWriteable

public boolean isWriteable()
Returns true if this instance can be saved.

Returns:
The Writeable value

setDirty

public void setDirty()
mark this class dirty for saving


saveNeeded

public boolean saveNeeded()
whether class needs saving

Returns:
true if save needed

lastModified

public long lastModified()
Returns:
the time that this class was last modified

isInterface

public boolean isInterface()

getMethodTags

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

Parameters:
superclasses -
tagName -
Returns:
a List of XTag. If no tags are found, an empty List is returned.

qualify

public XClass qualify(java.lang.String unqualifiedClassName)


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