Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.5.0)

E13403-06


oracle.javatools.parser.java.v2.model
Interface SourceClass

All Superinterfaces:
Element, JavaClass, JavaElement, JavaHasAnnotations, JavaHasName, JavaHasType, JavaIsGeneric, JavaMember, JavaType, SourceBlockElement, SourceElement, SourceHasModifiers, SourceHasName, SourceMember

public interface SourceClass
extends SourceMember, SourceHasName, SourceBlockElement, JavaClass

A SourceClass is the syntactic (aka symbolic) representation of a java class: classes, enums, interfaces, and annotation types.


Field Summary
static SourceClass[] EMPTY_ARRAY
           
static int PRINT_DECLARATION
          "modifiers class name<type_parameters extends bounds, ...>"
static int PRINT_NAME
          "name<type_parameters, ...>"

 

Fields inherited from interface oracle.javatools.parser.java.v2.model.SourceElement
CHILDREN_ALL, CHILDREN_BLANKLINES, CHILDREN_COMMENTS, CHILDREN_default, CHILDREN_none, CHILDREN_REGULAR, PRINT_ALL, REFORMAT_ALL, REFORMAT_INDENT

 

Method Summary
 SourceInterfacesClause getInterfacesClause()
          Gets the extends/implements clause object.
 SourceMember getOwningMember()
          Gets the owning member declaration, null if none.
 java.lang.String getPackageName()
          Gets the owning package name, empty if none.
 SourceClassBody getSourceBody()
          Gets the class body object.
 SourceClass getSourceClass(java.lang.String name)
          Gets the matching declared member class, null if none.
 java.util.List getSourceClasses()
          Gets the list of declared member class declarations.
 SourceMethod getSourceConstructor(JavaType[] targetTypes)
          Gets the matching declared constructor declaration, null if none.
 java.util.List getSourceConstructors()
          Gets the list of declared constructor declarations.
 java.util.List getSourceEnumConstants()
          Gets the list of declared enum constants.
 java.util.List getSourceFieldDeclarations()
          Gets the list of declared field declarations.
 SourceFieldVariable getSourceFieldVariable(java.lang.String name)
          Gets the matching declared field variable, null if none.
 java.util.Collection getSourceFieldVariables()
          Gets the collection of declared field.
 java.util.List getSourceInitializers()
          Gets the list of declared class initializers.
 java.util.List getSourceInterfaces()
          Gets the source superinterfaces.
 java.util.List getSourceMembers()
          Gets the list of declared member declarations.
 SourceMemberVariable getSourceMemberVariable(java.lang.String name)
          Gets the matching declared member variable, null if none.
 java.util.Collection getSourceMemberVariables()
          Gets the list of all enum constants and field variables.
 SourceMethod getSourceMethod(java.lang.String name, JavaType[] targetTypes)
          Gets the matching method declaration, null if none.
 java.util.List getSourceMethods()
          Gets the list of declared method (but not constructor) declarations.
 java.util.Collection getSourceMethods(java.lang.String name)
          Gets the collection of matching method (but not constructor) declarations.
 SourcePackage getSourcePackage()
          Gets the owning package declaration.
 SourceTypeReference getSourceSuperclass()
          Gets the source superclass.
 java.util.List getSourceTypeParameters()
          Gets the list of type parameters declared on this class.
 SourceSuperclassClause getSuperclassClause()
          Gets the extends/implements clause object.
 int getTypeKind()
          Identifies what kind of class declaration this is.
 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()
          Deprecated. Use isMemberClass(). Change made to match reflection.
 boolean isInterface()
          True if this is an interface or an annotation type.
 void setSourceSuperclass(SourceTypeReference superclass)
          Attempts to set the declared base class of this class.
 void setTypeKind(int typeKind)
          Attempts to change the type of class this is.

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceMember
getDocComment, getEnclosingClass, hasDeprecatedTag, hasHiddenTag, setDocComment

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceHasModifiers
addModifiers, getModifiers, getSourceAnnotations, removeModifiers, setModifiers

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceElement
addSelf, addSelf, addSelfAfter, addSelfBefore, clearBinding, cloneSelf, compile, getBinding, getChildren, getChildren, getCompiledObject, getContainedElements, getEndOffset, getOwningFile, getOwningSourceFile, getParent, getSiblingAfter, getSiblingBefore, getSiblings, getSiblings, getStartOffset, getSymbolKind, getText, print, print, reformatSelf, removeSelf, replaceSelf, resolve, setBinding, setContext, visitSelf

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceHasName
getName, getNameElement, setName, setNameElement

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaClass
clearCompiledInfo

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaType
equals, getArrayDimensions, getBaseComponentType, getClass, getClasses, getClinitMethod, getClosestClass, getComponentType, getDeclaredClass, getDeclaredClasses, getDeclaredConstructor, getDeclaredConstructors, getDeclaredField, getDeclaredFields, getDeclaredMethod, getDeclaredMethods, getDeclaredMethods, getDescriptor, getField, getFields, getHierarchy, getInterfaces, getMethod, getMethods, getMethods, getName, getPackage, getQualifiedName, getRawName, getSignature, getSuperclass, getThisValue, getTypeErasure, getTypeSignature, getUniqueIdentifier, getUnqualifiedName, getUnresolvedInterfaces, getURL, getVMName, isArray, isAssignableFrom, isMemberClass, isPrimitive, isSubtypeOf

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaIsGeneric
getActualTypeArguments, getTypeParameter, getTypeParameters, hasActualTypeArguments, hasTypeParameters

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaMember
getOwningClass, isAbstract, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasType
getResolvedType, getUnresolvedType

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasAnnotations
getAnnotation, getAnnotations, getDeclaredAnnotation, getDeclaredAnnotations

 

Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaElement
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo

 

Field Detail

EMPTY_ARRAY

static final SourceClass[] EMPTY_ARRAY

PRINT_NAME

static final int PRINT_NAME
"name<type_parameters, ...>"
See Also:
Constant Field Values

PRINT_DECLARATION

static final int PRINT_DECLARATION
"modifiers class name<type_parameters extends bounds, ...>"
See Also:
Constant Field Values

Method Detail

getTypeKind

int getTypeKind()
Identifies what kind of class declaration this is.
 TY_CLASS: "class".
 TY_ENUM: "enum".
 TY_INTERFACE: "interface".
 TY_ANNOTATE: "@interface".


Returns:
The JavaConstants.TY_* constant for this class.


setTypeKind

void setTypeKind(int 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.
Specified by:
isInterface in interface JavaType
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.
Specified by:
isEnum in interface JavaType
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.
Specified by:
isAnnotation in interface JavaType
Returns:
True if this is an annotation type. False otherwise.

getSourcePackage

SourcePackage getSourcePackage()
Gets the owning package declaration. Provided for convenience. This amounts to calling getOwningFile().getPackage().

getPackageName

java.lang.String getPackageName()
Gets the owning package name, empty if none. Provided for convenience. This amounts to calling getOwningFile().getPackageName().
Specified by:
getPackageName in interface JavaType
Returns:
The qualified name of the owning package. Empty if none.

isInnerClass

@Deprecated
boolean isInnerClass()
Deprecated. Use isMemberClass(). Change made to match reflection.
Returns:
True if this is an inner class. False otherwise.

isExported

boolean isExported()
Specified by:
isExported in interface JavaType
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.
Returns:
True if this is an anonymous class.

getSuperclassClause

SourceSuperclassClause getSuperclassClause()
Gets the extends/implements clause object. Access to the superclass clause is provided for clients who need to know offsets and contained comments. For getting and setting the superclass type reference, please use getSourceSuperclass() and setSourceSuperclass(SourceTypeReference).
Returns:
The super clause belonging to this class.

getInterfacesClause

SourceInterfacesClause getInterfacesClause()
Gets the extends/implements clause object. Access to the interfaces clause is provided for clients who need to know offsets and contained comments. For getting and setting of the superinterface type references, please use getSourceInterfaces().
Returns:
The super clause belonging to this class.

getSourceBody

SourceClassBody getSourceBody()
Gets the class body object. Access to the class body is provided for clients who need to know about offsets and contained comments. For getting and setting of class members, please use the various member getters on this class.
Returns:
The class body belonging to this class.

getSourceTypeParameters

java.util.List getSourceTypeParameters()
Gets the list of type parameters declared on this class. For classes, syntax is "javadoc mods class name <ty_params> {}".
Returns:
The array of type parameters. Null if none was declared. Returns a collection of SourceTypeParameter's.

getSourceSuperclass

SourceTypeReference getSourceSuperclass()
Gets the source superclass. Note, the "extends" clause of an interface represents superinterfaces not superclasses.
Returns:
The source-model declared base class. Will be non-null if a super class is declared, even if it is java.lang.Object or if the super class cannot be found.

setSourceSuperclass

void setSourceSuperclass(SourceTypeReference 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.

getSourceInterfaces

java.util.List getSourceInterfaces()
Gets the source superinterfaces. Not to be confused with inner classes that are interface types. The name was chosen to be consistent with JavaType and java/lang/Class.
Returns:
The source-model declared base interfaces. May be zero-length. Will have an element for each super interface that is declared, even if the super interface cannot be found. Returns a collection of SourceTypeReference's.

getSourceMembers

java.util.List getSourceMembers()
Gets the list of declared member declarations.
Returns:
All source-model declared members of this class, including synthetic members. This will include every member: methods, constructors, field declarations, enum constant declarations, inner classes, and initializers. Returns a collection of SourceMember's.

getSourceMemberVariables

java.util.Collection getSourceMemberVariables()
Gets the list of all enum constants and field variables.
Returns:
All source-model declared member variables of this class, including synthetic members.

getSourceMemberVariable

SourceMemberVariable getSourceMemberVariable(java.lang.String name)
Gets the matching declared member variable, null if none.
Parameters:
name - Require non-null.
Returns:
The first matching source-model declared member variable, null if none.

getSourceEnumConstants

java.util.List getSourceEnumConstants()
Gets the list of declared enum constants.
Returns:
All source-model declared enum constants. Returns a list of SourceEnumConstants's.

getSourceFieldDeclarations

java.util.List getSourceFieldDeclarations()
Gets the list of declared field declarations.
Returns:
All source-model declared field declarations. Should enum constants be returned separately from fields? Does not include the synthetic "this$0" field. Returns a collection of SourceFieldDeclaration's.

getSourceFieldVariables

java.util.Collection getSourceFieldVariables()
Gets the collection of declared field.
Returns:
All source-model declared field variables. Should enum constants be returned separately from fields? Does not include the synthetic "this$0" field. Returns a collection of SourceFieldVariable's.

getSourceFieldVariable

SourceFieldVariable getSourceFieldVariable(java.lang.String name)
Gets the matching declared field variable, null if none.
Parameters:
name - Require non-null.
Returns:
The first matching source-model declared field variable. Null if none.

getSourceMethods

java.util.List getSourceMethods()
Gets the list of declared method (but not constructor) declarations.
Returns:
All source-model declared methods of this class, not including constructors. Does not include the synthetic default constructor or the synthetic <clinit> method. Returns a collection of SourceMethod's.

getSourceMethods

java.util.Collection getSourceMethods(java.lang.String name)
Gets the collection of matching method (but not constructor) declarations.
Parameters:
name - Require non-null.
Returns:
All matching source-model declared methods of this class, not including constructors. Returns a collection of SourceMethod's.

getSourceMethod

SourceMethod getSourceMethod(java.lang.String name,
                             JavaType[] targetTypes)
Gets the matching method declaration, null if none.
Parameters:
name - Require non-null.
targetTypes - Null indicates an empty parameter list.
Returns:
The first matching declared source-model method (but not constructors). Null if none.

getSourceConstructors

java.util.List getSourceConstructors()
Gets the list of declared constructor declarations.
Returns:
All source-model declared constructors of this class. Does not include the synthetic default constructor nor the synthetic <clinit> method. Returns a collection of SourceMethod's.

getSourceConstructor

SourceMethod getSourceConstructor(JavaType[] targetTypes)
Gets the matching declared constructor declaration, null if none.
Parameters:
targetTypes - Null indicates an empty parameter list.
Returns:
The first matching declared source-model constructor. Null if none.

getSourceClasses

java.util.List getSourceClasses()
Gets the list of declared member class declarations.
Returns:
All source-model directly declared inner classes of this class. Returns a collection of SourceClass's.

getSourceClass

SourceClass getSourceClass(java.lang.String name)
Gets the matching declared member class, null if none.
Parameters:
name - Require non-null.
Returns:
The first matching source-model declared member class. Null if none.

getSourceInitializers

java.util.List getSourceInitializers()
Gets the list of declared class initializers.
Returns:
All source-model initializers declared in this class. Returns a collection of SourceClassInitializer's.

getOwningMember

SourceMember 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 Reference
11g Release 1 (11.1.1.5.0)

E13403-06


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