Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


javax.ide.model.java.source.tree
Interface ClassT

All Superinterfaces:
BlockElementT, HasModifiersT, HasNameT, MemberT, Tree

public interface ClassT
extends MemberT, HasNameT, BlockElementT

A type declaration. These include: "class" type, "interface" type, "enum" type, "annotation" type.


Nested Class Summary
static class ClassT.ClassKind
          An enumeration identifying which kind of type declaration this is.

 

Field Summary
static ClassT[] EMPTY_ARRAY
           

 

Method Summary
 ClassBodyT getClassBody()
          Gets the class body.
 ClassT getDeclaredClass(java.lang.String name)
          Gets the matching member class declarations.
 java.util.List getDeclaredClasses()
          Gets the list of member class declarations.
 java.util.List getDeclaredConstructors()
          Gets the list of declared constructor declarations.
 java.util.List getDeclaredEnumConstants()
          Gets the list of enum constants.
 java.util.List getDeclaredFieldDeclarations()
          Gets the list of declared field declarations.
 java.util.Collection getDeclaredFieldVariables()
          Gets the collection of declared field variables.
 java.util.List getDeclaredInitializers()
          Gets the list of declared class initializers.
 java.util.List getDeclaredMembers()
          Gets the list of declared member declarations.
 MemberVariableT getDeclaredMemberVariable(java.lang.String name)
          Gets the matching declared field variable or enum constant, null if none.
 java.util.Collection getDeclaredMemberVariables()
          Gets the collection of declared field variables and enum constants.
 java.util.List getDeclaredMethods()
          Gets the list of declared method (but not constructor) declarations.
 java.util.Collection getDeclaredMethods(java.lang.String name)
          Gets the collection of matching methods (but not constructor) declarations.
 java.util.List getInterfaces()
          Gets the list of declared interfaces.
 InterfacesT getInterfacesClause()
          Gets the interfaces declaration.
 MemberT getOwningMember()
          Gets the owning member declaration, null if none.
 PackageT getPackageDeclaration()
          Gets the owning package declaration, null if none..
 java.lang.String getPackageName()
          Gets the owning package name, empty if none.
 TypeReferenceT getSuperclass()
          Gets the declared superclass.
 SuperclassT getSuperclassClause()
          Gets the superclass declaration.
 ClassT.ClassKind getTypeKind()
          Identifies what kind of class declaration this is.
 java.util.List getTypeParameters()
          Gets the ordered list of type parameters declared on this class.
 boolean isAnnotation()
          True if this is an annotation type.
 boolean isAnonymous()
          True if this is an anonymous class declaration.
 boolean isClass()
          True if this is a class or an enum type.
 boolean isEnum()
          True if this is an enum type.
 boolean isExported()
           
 boolean isInnerClass()
          True if this is an inner class.
 boolean isInterface()
          True if this is an interface or an annotation type.
 void setSuperclass(TypeReferenceT superclass)
          Attempts to set the declared base class of this class.
 void setTypeKind(ClassT.ClassKind typeKind)
          Attempts to change the type of class this is.

 

Methods inherited from interface javax.ide.model.java.source.tree.MemberT
getBlock, getDeclaringClass, getDocComment, setBlock, setDocComment

 

Methods inherited from interface javax.ide.model.java.source.tree.HasModifiersT
addModifiers, getAnnotations, getModifiers, isAbstract, isFinal, isPrivate, isProtected, isPublic, isStatic, isStrictfp, removeModifiers, setModifiers

 

Methods inherited from interface javax.ide.model.java.source.tree.Tree
accept, addSelf, addSelf, addSelfAfter, addSelfBefore, clearProperty, cloneSelf, getChildren, getOwningFile, getParent, getPosition, getProperty, getSiblingAfter, getSiblingBefore, getSiblings, getTreeKind, isSynthetic, removeSelf, replaceSelf, setProperty

 

Methods inherited from interface javax.ide.model.java.source.tree.HasNameT
getName, getNameElement, setName, setNameElement

 

Field Detail

EMPTY_ARRAY

static final ClassT[] EMPTY_ARRAY

Method Detail

getTypeKind

ClassT.ClassKind getTypeKind()
Identifies what kind of class declaration this is.
Returns:
The JavaConstants.TY_* constant for this class.

setTypeKind

void setTypeKind(ClassT.ClassKind typeKind)
Attempts to change the type of class this is.
 TY_CLASS: "class".
 TY_ENUM: "enum".
 TY_INTERFACE: "interface".
 TY_ANNOTATE: "@interface".




isClass

boolean isClass()
True if this is a class or an enum type. Backward compatible. Checks against the presence of ACC_INTERFACE.
Returns:
True if this is a class or enum type. False if this is an interface or annotation type.

isInterface

boolean isInterface()
True if this is an interface or an annotation type. Backward compatible. Checks for the presence of ACC_INTERFACE.
Returns:
True if this is an interface or annotation type. False if this is a class or enum type.

isEnum

boolean isEnum()
True if this is an enum type. Checks for the presence of ACC_ENUM. If true, then isClass() should also be true.
Returns:
True if this is an enum type. False otherwise.

isAnnotation

boolean isAnnotation()
True if this is an annotation type. Checks for the presence of ACC_ANNOTATION. If true, then isInterface() should also be true.
Returns:
True if this is an annotation type. False otherwise.

getPackageDeclaration

PackageT getPackageDeclaration()
Gets the owning package declaration, null if none.. This amounts to calling getOwningSourceFile().getPackage().
Returns:
The package declaration element.

getPackageName

java.lang.String getPackageName()
Gets the owning package name, empty if none. Provided for convenience. This amounts to calling getOwningSourceFile().getPackageName() with a null check.
Returns:
Gets the owning package name, empty if none. Always non-null.

isInnerClass

boolean isInnerClass()
True if this is an inner class. Member, local, and anonymous classes are all considered to be inner classes.
Returns:
True if this is an inner class. False otherwise.

isExported

boolean isExported()
Returns:
True if this is a top-level class or a member class. False otherwise.

isAnonymous

boolean isAnonymous()
True if this is an anonymous class declaration. Anonymous classes return true for isClass().
Returns:
True if this is an anonymous class.

getSuperclassClause

SuperclassT getSuperclassClause()
Gets the superclass declaration. On a "class" type, this will be the "extends" clause.
Returns:
The super clause belonging to this class. Always non-null. If there is no superclass clause, then a synthetic one is returned.

getInterfacesClause

InterfacesT getInterfacesClause()
Gets the interfaces declaration. On a "class" or "enum" type, this will be the "implements" clause. On an "interface" type, this will be the "extends" clause.
Returns:
The super clause belonging to this class. Always non-null. If there is no interfaces clause, then a synthetic one is returned.

getClassBody

ClassBodyT getClassBody()
Gets the class body.
Returns:
The class body belonging to this class. Always non-null. If there is no class body, then a synthetic one is returned. Note: It is a compile error if there is no class body.

getTypeParameters

java.util.List getTypeParameters()
Gets the ordered list of type parameters declared on this class. Remember, type parameters are not inherited by subclasses (and subinterfaces).

For classes, syntax is "javadoc mods class name <ty_params> {}".

Returns:
The list of type parameters.

List of TypeParameterTs.


getSuperclass

TypeReferenceT getSuperclass()
Gets the declared superclass. On a "class" type, this will be the "extends" type.
Returns:
The explicitly declared superclass. Will be non-null if a superclass is declared, even if the superclass cannot be legally resolved. Will be null if no superclass is declared regardless of the implicit superclass declaration.

setSuperclass

void setSuperclass(TypeReferenceT superclass)
Attempts to set the declared base class of this class.
Throws:
java.lang.UnsupportedOperationException - if this class may not have a superclass.
java.lang.IllegalStateException - if the input element is already linked.

getInterfaces

java.util.List getInterfaces()
Gets the list of declared interfaces. Do not confuse this with inner classes that are "interface" types. The name was chosen to be consistent with JavaType and java/lang/Class.

On a "class" or "enum" type, this will be the "implements" types. On an "interface" type, this will be the "extends" types.

Returns:
The list of explicitly declared interfaces. Will have an element for each super interface that is declared, even if the super interface cannot be legally resolved.

List of TypeReferenceTs.


getDeclaredMembers

java.util.List getDeclaredMembers()
Gets the list of declared member declarations.
Returns:
All declared members of this class, not including synthetic members (e.g. default constructor). This includes: methods, constuctors, field declarations, enum constant declarations, member classes, and class initializers.

List of MemberTs.


getDeclaredMemberVariables

java.util.Collection getDeclaredMemberVariables()
Gets the collection of declared field variables and enum constants.
Returns:
All declared field variables and enum constants, not including synthetic ones (e.g. "this$0").

Collection of MemberVariableTs.


getDeclaredMemberVariable

MemberVariableT getDeclaredMemberVariable(java.lang.String name)
Gets the matching declared field variable or enum constant, null if none.
Parameters:
name - The field or enum constant name to match. Require non-null.
Returns:
The first matching source-model declared field or enum constant. Null if none.

getDeclaredEnumConstants

java.util.List getDeclaredEnumConstants()
Gets the list of enum constants. Collection of EnumConstantTs.

getDeclaredFieldDeclarations

java.util.List getDeclaredFieldDeclarations()
Gets the list of declared field declarations. Does NOT include enum constant declarations.
Returns:
All declared field declarations, not including synthetic ones (e.g. "this$0"). This does NOT includes enum constant declarations.

List of FieldDeclTs.


getDeclaredFieldVariables

java.util.Collection getDeclaredFieldVariables()
Gets the collection of declared field variables. Does NOT include enum constant variables.
Returns:
All declared field variables, not including synthetic ones (e.g. "this$0"). This does NOT includes enum constant variables.

Collection of FieldVariableTs.


getDeclaredMethods

java.util.List getDeclaredMethods()
Gets the list of declared method (but not constructor) declarations.
Returns:
All declared methods, not including constructors and not including synthetic ones (e.g. "values()", "<clinit>()").

List of MethodTs.


getDeclaredMethods

java.util.Collection getDeclaredMethods(java.lang.String name)
Gets the collection of matching methods (but not constructor) declarations. This list will not be filtered according to method signature. In other words, if there are multiple methods listed with the same signature, this list will include them all.
Parameters:
name - The method name to match. Require non-null.
Returns:
All matching declared methods, but not constructors and not synthetic ones (e.g. "values()", "<clinit>()").

Collection of MethodTs.


getDeclaredConstructors

java.util.List getDeclaredConstructors()
Gets the list of declared constructor declarations.
Returns:
All declared constructor declarations, not including synthetic ones.

List of MethodTs.


getDeclaredClasses

java.util.List getDeclaredClasses()
Gets the list of member class declarations. To be clear, this list does not include local or anonymous classes.
Returns:
All declared member classes.

List of ClassTs.


getDeclaredClass

ClassT getDeclaredClass(java.lang.String name)
Gets the matching member class declarations. To be clear, this will not return a local or anonymous class.
Parameters:
name - The class name to match.
Returns:
The first matching member class.

getDeclaredInitializers

java.util.List getDeclaredInitializers()
Gets the list of declared class initializers. To be clear, this list does NOT include the implicit block elements generated for member variable initializers.
Returns:
All initializers declared in this class, not including synthetic ones.

List of ClassInitializerTs.


getOwningMember

MemberT getOwningMember()
Gets the owning member declaration, null if none.

The Java VM spec 3rd ed requires that local and anonymous classes have an attribute specifying the enclosing method. At a source level, we'll return the owning member.

Returns:
The directly enclosing member. If the directly enclosing member is a class, then this will return the same thing as getOwningClass(). If this is a top-level class, this will return null.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


Copyright © 1997, 2012, Oracle. All rights reserved.