Class TypeDeclaration
- Direct Known Subclasses:
AjTypeDeclaration
TypeDeclaration:
ClassDeclaration
InterfaceDeclaration
ClassDeclaration:
[ Javadoc ] { ExtendedModifier } class Identifier
[ < TypeParameter { , TypeParameter } > ]
[ extends Type ]
[ implements Type { , Type } ]
[ permits Type { , Type } ]
{ { ClassBodyDeclaration | ; } }
InterfaceDeclaration:
[ Javadoc ] { ExtendedModifier } interface Identifier
[ < TypeParameter { , TypeParameter } > ]
[ extends Type { , Type } ]
[ permits Type { , Type } ]
{ { InterfaceBodyDeclaration | ; } }
When a Javadoc comment is present, the source range begins with the first character of the "/**" comment delimiter. When there is no Javadoc comment, the source range begins with the first character of the first modifier or annotation (if any), or the first character of the "class" or "interface" keyword (if no modifiers or annotations). The source range extends through the last character of the "}" token following the body declarations.
- Since:
- 2.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChildListPropertyDescriptorThe "bodyDeclarations" structural property of this node type (element type:BodyDeclaration) (added in JLS3 API).static final SimplePropertyDescriptorThe "interface" structural property of this node type (type:Boolean).static final ChildPropertyDescriptorThe "javadoc" structural property of this node type (child type:Javadoc).static final SimplePropertyDescriptorDeprecated.static final ChildListPropertyDescriptorThe "modifiers" structural property of this node type (element type:IExtendedModifier) (added in JLS3 API).static final ChildPropertyDescriptorThe "name" structural property of this node type (child type:SimpleName).static final ChildListPropertyDescriptorThe "permitsTypes" structural property of this node type (element type:Type) (added in JLS15 API).protected static ListA list of property descriptors (element type:StructuralPropertyDescriptor), or null if uninitialized.protected static ListA list of property descriptors (element type:StructuralPropertyDescriptor), or null if uninitialized.static final ChildListPropertyDescriptorThe "superInterfaceTypes" structural property of this node type (element type:Type) (added in JLS3 API).static final ChildListPropertyDescriptorDeprecated.In the JLS3 API, this property is replaced bySUPER_INTERFACE_TYPES_PROPERTY.static final ChildPropertyDescriptorDeprecated.In the JLS3 API, this property is replaced bySUPERCLASS_TYPE_PROPERTY.static final ChildPropertyDescriptorThe "superclassType" structural property of this node type (child type:Type) (added in JLS3 API).protected org.aspectj.org.eclipse.jdt.core.dom.ASTNode.NodeListThe superinterface names (element type:Name).protected org.aspectj.org.eclipse.jdt.core.dom.ASTNode.NodeListThe superinterface types (element type:Type).static final ChildListPropertyDescriptorThe "typeParameters" structural property of this node type (element type:TypeParameter) (added in JLS3 API).protected org.aspectj.org.eclipse.jdt.core.dom.ASTNode.NodeListThe type parameters (element type:TypeParameter).Fields inherited from class ASTNode
ANNOTATION_TYPE_DECLARATION, ANNOTATION_TYPE_MEMBER_DECLARATION, ANONYMOUS_CLASS_DECLARATION, ARRAY_ACCESS, ARRAY_CREATION, ARRAY_INITIALIZER, ARRAY_TYPE, ASSERT_STATEMENT, ASSIGNMENT, BLOCK, BLOCK_COMMENT, BOOLEAN_LITERAL, BREAK_STATEMENT, CASE_DEFAULT_EXPRESSION, CAST_EXPRESSION, CATCH_CLAUSE, CHARACTER_LITERAL, CLASS_INSTANCE_CREATION, COMPILATION_UNIT, CONDITIONAL_EXPRESSION, CONSTRUCTOR_INVOCATION, CONTINUE_STATEMENT, CREATION_REFERENCE, DIMENSION, DO_STATEMENT, EitherOr_MultiPattern, EMPTY_STATEMENT, ENHANCED_FOR_STATEMENT, ENUM_CONSTANT_DECLARATION, ENUM_DECLARATION, EXPORTS_DIRECTIVE, EXPRESSION_METHOD_REFERENCE, EXPRESSION_STATEMENT, FIELD_ACCESS, FIELD_DECLARATION, FOR_STATEMENT, GUARDED_PATTERN, IF_STATEMENT, IMPORT_DECLARATION, INFIX_EXPRESSION, INITIALIZER, INSTANCEOF_EXPRESSION, INTERSECTION_TYPE, JAVADOC, JAVADOC_REGION, JAVADOC_TEXT_ELEMENT, LABELED_STATEMENT, LAMBDA_EXPRESSION, LINE_COMMENT, MALFORMED, MARKER_ANNOTATION, MEMBER_REF, MEMBER_VALUE_PAIR, METHOD_DECLARATION, METHOD_INVOCATION, METHOD_REF, METHOD_REF_PARAMETER, MODIFIER, MODULE_DECLARATION, MODULE_MODIFIER, MODULE_QUALIFIED_NAME, NAME_QUALIFIED_TYPE, NORMAL_ANNOTATION, NULL_LITERAL, NULL_PATTERN, NUMBER_LITERAL, OPENS_DIRECTIVE, ORIGINAL, PACKAGE_DECLARATION, PARAMETERIZED_TYPE, PARENTHESIZED_EXPRESSION, PATTERN_INSTANCEOF_EXPRESSION, POSTFIX_EXPRESSION, PREFIX_EXPRESSION, PRIMITIVE_TYPE, PROTECT, PROVIDES_DIRECTIVE, QUALIFIED_NAME, QUALIFIED_TYPE, RECORD_DECLARATION, RECORD_PATTERN, RECOVERED, REQUIRES_DIRECTIVE, RETURN_STATEMENT, SIMPLE_NAME, SIMPLE_TYPE, SINGLE_MEMBER_ANNOTATION, SINGLE_VARIABLE_DECLARATION, STRING_LITERAL, SUPER_CONSTRUCTOR_INVOCATION, SUPER_FIELD_ACCESS, SUPER_METHOD_INVOCATION, SUPER_METHOD_REFERENCE, SWITCH_CASE, SWITCH_EXPRESSION, SWITCH_STATEMENT, SYNCHRONIZED_STATEMENT, TAG_ELEMENT, TAG_PROPERTY, TEXT_BLOCK, TEXT_ELEMENT, THIS_EXPRESSION, THROW_STATEMENT, TRY_STATEMENT, TYPE_DECLARATION, TYPE_DECLARATION_STATEMENT, TYPE_LITERAL, TYPE_METHOD_REFERENCE, TYPE_PARAMETER, TYPE_PATTERN, UNION_TYPE, UNNAMED_CLASS, USES_DIRECTIVE, VARIABLE_DECLARATION_EXPRESSION, VARIABLE_DECLARATION_FRAGMENT, VARIABLE_DECLARATION_STATEMENT, WHILE_STATEMENT, WILDCARD_TYPE, YIELD_STATEMENTModifier and TypeFieldDescriptionstatic final intNode type constant indicating a node of typeAnnotationTypeDeclaration.static final intNode type constant indicating a node of typeAnnotationTypeMemberDeclaration.static final intNode type constant indicating a node of typeAnonymousClassDeclaration.static final intNode type constant indicating a node of typeArrayAccess.static final intNode type constant indicating a node of typeArrayCreation.static final intNode type constant indicating a node of typeArrayInitializer.static final intNode type constant indicating a node of typeArrayType.static final intNode type constant indicating a node of typeAssertStatement.static final intNode type constant indicating a node of typeAssignment.static final intNode type constant indicating a node of typeBlock.static final intNode type constant indicating a node of typeBlockComment.static final intNode type constant indicating a node of typeBooleanLiteral.static final intNode type constant indicating a node of typeBreakStatement.static final intNode type constant indicating a node of typeCaseDefaultExpression.static final intNode type constant indicating a node of typeCastExpression.static final intNode type constant indicating a node of typeCatchClause.static final intNode type constant indicating a node of typeCharacterLiteral.static final intNode type constant indicating a node of typeClassInstanceCreation.static final intNode type constant indicating a node of typeCompilationUnit.static final intNode type constant indicating a node of typeConditionalExpression.static final intNode type constant indicating a node of typeConstructorInvocation.static final intNode type constant indicating a node of typeContinueStatement.static final intNode type constant indicating a node of typeCreationReference.static final intNode type constant indicating a node of typeDimension.static final intNode type constant indicating a node of typeDoStatement.static final intNode type constant indicating a node of typeEitherOrMultiPattern.static final intNode type constant indicating a node of typeEmptyStatement.static final intNode type constant indicating a node of typeEnhancedForStatement.static final intNode type constant indicating a node of typeEnumConstantDeclaration.static final intNode type constant indicating a node of typeEnumDeclaration.static final intNode type constant indicating a node of typeExportsDirective.static final intNode type constant indicating a node of typeExpressionMethodReference.static final intNode type constant indicating a node of typeExpressionStatement.static final intNode type constant indicating a node of typeFieldAccess.static final intNode type constant indicating a node of typeFieldDeclaration.static final intNode type constant indicating a node of typeForStatement.static final intNode type constant indicating a node of typeGuardedPattern.static final intNode type constant indicating a node of typeIfStatement.static final intNode type constant indicating a node of typeImportDeclaration.static final intNode type constant indicating a node of typeInfixExpression.static final intNode type constant indicating a node of typeInitializer.static final intNode type constant indicating a node of typeInstanceofExpression.static final intNode type constant indicating a node of typeIntersectionType.static final intNode type constant indicating a node of typeJavadoc.static final intNode type constant indicating a node of typeJavaDocRegion.static final intNode type constant indicating a node of typeTextElement.static final intNode type constant indicating a node of typeLabeledStatement.static final intNode type constant indicating a node of typeLambdaExpression.static final intNode type constant indicating a node of typeLineComment.static final intFlag constant (bit mask, value 1) indicating that there is something not quite right with this AST node.static final intNode type constant indicating a node of typeMarkerAnnotation.static final intNode type constant indicating a node of typeMemberRef.static final intNode type constant indicating a node of typeMemberValuePair.static final intNode type constant indicating a node of typeMethodDeclaration.static final intNode type constant indicating a node of typeMethodInvocation.static final intNode type constant indicating a node of typeMethodRef.static final intNode type constant indicating a node of typeMethodRefParameter.static final intNode type constant indicating a node of typeModifier.static final intNode type constant indicating a node of typeModuleDeclaration.static final intNode type constant indicating a node of typeModuleModifier.static final intNode type constant indicating a node of typeModuleQualifiedName.static final intNode type constant indicating a node of typeNameQualifiedType.static final intNode type constant indicating a node of typeNormalAnnotation.static final intNode type constant indicating a node of typeNullLiteral.static final intNode type constant indicating a node of typeNullPattern.static final intNode type constant indicating a node of typeNumberLiteral.static final intNode type constant indicating a node of typeOpensDirective.static final intFlag constant (bit mask, value 2) indicating that this is a node that was created by the parser (as opposed to one created by another party).static final intNode type constant indicating a node of typePackageDeclaration.static final intNode type constant indicating a node of typeParameterizedType.static final intNode type constant indicating a node of typeParenthesizedExpression.static final intNode type constant indicating a node of typePatternInstanceofExpression.static final intNode type constant indicating a node of typePostfixExpression.static final intNode type constant indicating a node of typePrefixExpression.static final intNode type constant indicating a node of typePrimitiveType.static final intFlag constant (bit mask, value 4) indicating that this node is unmodifiable.static final intNode type constant indicating a node of typeProvidesDirective.static final intNode type constant indicating a node of typeQualifiedName.static final intNode type constant indicating a node of typeQualifiedType.static final intNode type constant indicating a node of typeRecordDeclaration.static final intNode type constant indicating a node of typeRecordPattern.static final intFlag constant (bit mask, value 8) indicating that this node or a part of this node is recovered from source that contains a syntax error detected in the vicinity.static final intNode type constant indicating a node of typeRequiresDirective.static final intNode type constant indicating a node of typeReturnStatement.static final intNode type constant indicating a node of typeSimpleName.static final intNode type constant indicating a node of typeSimpleType.static final intNode type constant indicating a node of typeSingleMemberAnnotation.static final intNode type constant indicating a node of typeSingleVariableDeclaration.static final intNode type constant indicating a node of typeStringLiteral.static final intNode type constant indicating a node of typeSuperConstructorInvocation.static final intNode type constant indicating a node of typeSuperFieldAccess.static final intNode type constant indicating a node of typeSuperMethodInvocation.static final intNode type constant indicating a node of typeSuperMethhodReference.static final intNode type constant indicating a node of typeSwitchCase.static final intNode type constant indicating a node of typeSwitchExpression.static final intNode type constant indicating a node of typeSwitchStatement.static final intNode type constant indicating a node of typeSynchronizedStatement.static final intNode type constant indicating a node of typeTagElement.static final intNode type constant indicating a node of typeTagProperty.static final intNode type constant indicating a node of typeTextBlock.static final intNode type constant indicating a node of typeTextElement.static final intNode type constant indicating a node of typeThisExpression.static final intNode type constant indicating a node of typeThrowStatement.static final intNode type constant indicating a node of typeTryStatement.static final intNode type constant indicating a node of typeTypeDeclaration.static final intNode type constant indicating a node of typeTypeDeclarationStatement.static final intNode type constant indicating a node of typeTypeLiteral.static final intNode type constant indicating a node of typeTypeMethodReference.static final intNode type constant indicating a node of typeTypeParameter.static final intNode type constant indicating a node of typeTypePattern.static final intNode type constant indicating a node of typeUnionType.static final intstatic final intNode type constant indicating a node of typeUsesDirective.static final intNode type constant indicating a node of typeVariableDeclarationExpression.static final intNode type constant indicating a node of typeVariableDeclarationFragment.static final intNode type constant indicating a node of typeVariableDeclarationStatement.static final intNode type constant indicating a node of typeWhileStatement.static final intNode type constant indicating a node of typeWildcardType.static final intNode type constant indicating a node of typeYieldStatement. -
Method Summary
Modifier and TypeMethodDescriptionReturns the ordered list of field declarations of this type declaration.Returns the ordered list of method declarations of this type declaration.intA character index into the original restricted identifier source string, or-1if no restricted identifier source position information is available for this node;-1by default.Deprecated.In the JLS3 API, this method is replaced bygetSuperclassType(), which returns aTypeinstead of aName.Returns the superclass declared in this type declaration, ornullif there is none (added in JLS3 API).static TypeDeclarationgetTypeDeclaration(AST ast) getTypes()Returns the ordered list of member type declarations of this type declaration.booleanReturns whether this type declaration declares a class or an interface.Returns the live ordered list of permits of this type declaration (added in JLS17 API).static ListpropertyDescriptors(int apiLevel) Returns a list of structural property descriptors for this node type.voidsetInterface(boolean isInterface) Sets whether this type declaration declares a class or an interface.voidsetRestrictedIdentifierStartPosition(int restrictedIdentifierStartPosition) A character index into the original restricted identifier source string, or-1if no restricted identifier source position information is available for this node;-1by default.voidsetSuperclass(Name superclassName) Deprecated.In the JLS3 API, this method is replaced bysetSuperclassType(Type), which expects aTypeinstead of aName.voidsetSuperclassType(Type superclassType) Sets or clears the superclass declared in this type declaration (added in JLS3 API).Deprecated.In the JLS3 API, this method is replaced bysuperInterfaceTypes().Returns the live ordered list of superinterfaces of this type declaration (added in JLS3 API).Returns the live ordered list of type parameters of this type declaration (added in JLS3 API).Methods inherited from class AbstractTypeDeclaration
bodyDeclarations, getBodyDeclarationsProperty, getName, getNameProperty, isLocalTypeDeclaration, isMemberTypeDeclaration, isPackageMemberTypeDeclaration, resolveBinding, setNameModifier and TypeMethodDescriptionReturns the live ordered list of body declarations of this type declaration.Returns structural property descriptor for the "bodyDeclarations" property of this node (element type:BodyDeclaration).getName()Returns the name of the type declared in this type declaration.final ChildPropertyDescriptorReturns structural property descriptor for the "name" property of this node (child type:SimpleName).booleanReturns whether this type declaration is a local type.booleanReturns whether this type declaration is a type member.booleanReturns whether this type declaration is a package member (that is, a top-level type).final ITypeBindingResolves and returns the binding for the type declared in this type declaration.voidsetName(SimpleName typeName) Sets the name of the type declared in this type declaration to the given name.Methods inherited from class BodyDeclaration
getJavadoc, getJavadocProperty, getModifiers, getModifiersProperty, modifiers, setJavadoc, setModifiersModifier and TypeMethodDescriptionReturns the doc comment node.final ChildPropertyDescriptorReturns structural property descriptor for the "javadoc" property of this node (child type:Javadoc).intReturns the modifiers explicitly specified on this declaration.Returns structural property descriptor for the "modifiers" property of this node as used in JLS3 (element type:IExtendedModifier).Returns the live ordered list of modifiers and annotations of this declaration (added in JLS3 API).voidsetJavadoc(Javadoc docComment) Sets or clears the doc comment node.voidsetModifiers(int modifiers) Deprecated.In the JLS3 API, this method is replaced byBodyDeclaration.modifiers(), which contains a list ofModifiernodes.Methods inherited from class ASTNode
accept, copySubtree, copySubtrees, delete, equals, getAST, getFlags, getLength, getLocationInParent, getNodeType, getParent, getProperty, getRoot, getStartPosition, getStructuralProperty, hashCode, nodeClassForType, properties, setFlags, setProperty, setSourceRange, setStructuralProperty, structuralPropertiesForType, subtreeBytes, subtreeMatch, toStringModifier and TypeMethodDescriptionfinal voidaccept(ASTVisitor visitor) Accepts the given visitor on a visit of the current node.static ASTNodecopySubtree(AST target, ASTNode node) Returns a deep copy of the subtree of AST nodes rooted at the given node.static ListcopySubtrees(AST target, List nodes) Returns a deep copy of the subtrees of AST nodes rooted at the given list of nodes.final voiddelete()Removes this node from its parent.final booleanTheASTNodeimplementation of thisObjectmethod uses object identity (==).final ASTgetAST()Returns this node's AST.final intgetFlags()Returns the flags associated with this node.final intReturns the length in characters of the original source file indicating where the source fragment corresponding to this node ends.Returns the location of this node within its parent, ornullif this is a root node.final intReturns an integer value identifying the type of this concrete AST node.final ASTNodeReturns this node's parent node, ornullif this is the root node.final ObjectgetProperty(String propertyName) Returns the value of the named property of this node, ornullif none.final ASTNodegetRoot()Returns the root node at or above this node; returns this node if it is a root.final intReturns the character index into the original source file indicating where the source fragment corresponding to this node begins.final ObjectReturns the value of the given structural property for this node.final inthashCode()static ClassnodeClassForType(int nodeType) Returns the node class for the corresponding node type.final MapReturns an unmodifiable table of the properties of this node with non-nullvalues.final voidsetFlags(int flags) Sets the flags associated with this node to the given value.final voidsetProperty(String propertyName, Object data) Sets the named property of this node to the given value, or tonullto clear it.final voidsetSourceRange(int startPosition, int length) Sets the source range of the original source file where the source fragment corresponding to this node was found.final voidsetStructuralProperty(StructuralPropertyDescriptor property, Object value) Sets the value of the given structural property for this node.final ListReturns a list of structural property descriptors for nodes of the same type as this node.final intReturns an estimate of the memory footprint in bytes of the entire subtree rooted at this node.final booleansubtreeMatch(ASTMatcher matcher, Object other) Returns whether the subtree rooted at the given node matches the given other object as decided by the given matcher.final StringtoString()Returns a string representation of this node suitable for debugging purposes only.
-
Field Details
-
JAVADOC_PROPERTY
The "javadoc" structural property of this node type (child type:Javadoc).- Since:
- 3.0
-
MODIFIERS_PROPERTY
Deprecated.In the JLS3 API, this property is replaced byMODIFIERS2_PROPERTY.The "modifiers" structural property of this node type (type:Integer) (JLS2 API only).- Since:
- 3.0
-
MODIFIERS2_PROPERTY
The "modifiers" structural property of this node type (element type:IExtendedModifier) (added in JLS3 API).- Since:
- 3.1
-
INTERFACE_PROPERTY
The "interface" structural property of this node type (type:Boolean).- Since:
- 3.0
-
NAME_PROPERTY
The "name" structural property of this node type (child type:SimpleName).- Since:
- 3.0
-
SUPERCLASS_PROPERTY
Deprecated.In the JLS3 API, this property is replaced bySUPERCLASS_TYPE_PROPERTY.The "superclass" structural property of this node type (child type:Name) (JLS2 API only).- Since:
- 3.0
-
SUPER_INTERFACES_PROPERTY
Deprecated.In the JLS3 API, this property is replaced bySUPER_INTERFACE_TYPES_PROPERTY.The "superInterfaces" structural property of this node type (element type:Name) (JLS2 API only).- Since:
- 3.0
-
SUPERCLASS_TYPE_PROPERTY
The "superclassType" structural property of this node type (child type:Type) (added in JLS3 API).- Since:
- 3.1
-
SUPER_INTERFACE_TYPES_PROPERTY
The "superInterfaceTypes" structural property of this node type (element type:Type) (added in JLS3 API).- Since:
- 3.1
-
TYPE_PARAMETERS_PROPERTY
The "typeParameters" structural property of this node type (element type:TypeParameter) (added in JLS3 API).- Since:
- 3.1
-
BODY_DECLARATIONS_PROPERTY
The "bodyDeclarations" structural property of this node type (element type:BodyDeclaration) (added in JLS3 API).- Since:
- 3.0
-
PERMITS_TYPES_PROPERTY
The "permitsTypes" structural property of this node type (element type:Type) (added in JLS15 API).- Since:
- 3.24
-
PROPERTY_DESCRIPTORS_2_0
A list of property descriptors (element type:StructuralPropertyDescriptor), or null if uninitialized.- Since:
- 3.10 // Up'd from 3.0 because of @since check due to raising visibility
-
PROPERTY_DESCRIPTORS_3_0
A list of property descriptors (element type:StructuralPropertyDescriptor), or null if uninitialized.- Since:
- 3.10 // Up'd from 3.1 because of @since check due to raising visibility
-
typeParameters
protected org.aspectj.org.eclipse.jdt.core.dom.ASTNode.NodeList typeParametersThe type parameters (element type:TypeParameter). Null in JLS2. Added in JLS3; defaults to an empty list (see constructor).- Since:
- 3.10 // Up'd from 3.1 because of @since check due to raising visibility
-
superInterfaceNames
protected org.aspectj.org.eclipse.jdt.core.dom.ASTNode.NodeList superInterfaceNamesThe superinterface names (element type:Name). JLS2 only; defaults to an empty list. Not used in JLS3. (see constructor).- Since:
- 3.10 // Added because of @since check due to raising visibility
-
superInterfaceTypes
protected org.aspectj.org.eclipse.jdt.core.dom.ASTNode.NodeList superInterfaceTypesThe superinterface types (element type:Type). Null in JLS2. Added in JLS3; defaults to an empty list (see constructor).- Since:
- 3.10 // Up'd from 3.1 because of @since check due to raising visibility
-
-
Method Details
-
getTypeDeclaration
- Since:
- 3.10
-
propertyDescriptors
Returns a list of structural property descriptors for this node type. Clients must not modify the result.- Parameters:
apiLevel- the API level; one of theAST.JLS*constants- Returns:
- a list of property descriptors (element type:
StructuralPropertyDescriptor) - Since:
- 3.0
-
isInterface
public boolean isInterface()Returns whether this type declaration declares a class or an interface.- Returns:
trueif this is an interface declaration, andfalseif this is a class declaration
-
setInterface
public void setInterface(boolean isInterface) Sets whether this type declaration declares a class or an interface.- Parameters:
isInterface-trueif this is an interface declaration, andfalseif this is a class declaration
-
typeParameters
Returns the live ordered list of type parameters of this type declaration (added in JLS3 API). This list is non-empty for parameterized types.- Returns:
- the live list of type parameters
(element type:
TypeParameter) - Throws:
UnsupportedOperationException- if this operation is used in a JLS2 AST- Since:
- 3.1
-
getSuperclass
Deprecated.In the JLS3 API, this method is replaced bygetSuperclassType(), which returns aTypeinstead of aName.Returns the name of the superclass declared in this type declaration, ornullif there is none (JLS2 API only).Note that this child is not relevant for interface declarations (although it does still figure in subtree equality comparisons).
- Returns:
- the superclass name node, or
nullif there is none - Throws:
UnsupportedOperationException- if this operation is used in an AST later than JLS2
-
getSuperclassType
Returns the superclass declared in this type declaration, ornullif there is none (added in JLS3 API).Note that this child is not relevant for interface declarations (although it does still figure in subtree equality comparisons).
- Returns:
- the superclass type node, or
nullif there is none - Throws:
UnsupportedOperationException- if this operation is used in a JLS2 AST- Since:
- 3.1
-
setSuperclass
Deprecated.In the JLS3 API, this method is replaced bysetSuperclassType(Type), which expects aTypeinstead of aName.Sets or clears the name of the superclass declared in this type declaration (JLS2 API only).Note that this child is not relevant for interface declarations (although it does still figure in subtree equality comparisons).
- Parameters:
superclassName- the superclass name node, ornullif there is none- Throws:
IllegalArgumentException- if:- the node belongs to a different AST
- the node already has a parent
UnsupportedOperationException- if this operation is used in an AST later than JLS2
-
setSuperclassType
Sets or clears the superclass declared in this type declaration (added in JLS3 API).Note that this child is not relevant for interface declarations (although it does still figure in subtree equality comparisons).
- Parameters:
superclassType- the superclass type node, ornullif there is none- Throws:
IllegalArgumentException- if:- the node belongs to a different AST
- the node already has a parent
UnsupportedOperationException- if this operation is used in a JLS2 AST- Since:
- 3.1
-
superInterfaces
Deprecated.In the JLS3 API, this method is replaced bysuperInterfaceTypes().Returns the live ordered list of names of superinterfaces of this type declaration (JLS2 API only). For a class declaration, these are the names of the interfaces that this class implements; for an interface declaration, these are the names of the interfaces that this interface extends.- Returns:
- the live list of interface names
(element type:
Name) - Throws:
UnsupportedOperationException- if this operation is used in an AST later than JLS2
-
superInterfaceTypes
Returns the live ordered list of superinterfaces of this type declaration (added in JLS3 API). For a class declaration, these are the interfaces that this class implements; for an interface declaration, these are the interfaces that this interface extends.- Returns:
- the live list of interface types
(element type:
Type) - Throws:
UnsupportedOperationException- if this operation is used in a JLS2 AST- Since:
- 3.1
-
permittedTypes
Returns the live ordered list of permits of this type declaration (added in JLS17 API). For a type declaration, these are the permitted types which can implement/extend this sealed type.- Returns:
- the live list of types
(element type:
Type) - Throws:
UnsupportedOperationException- if this operation is not used with Java 17 and above- Since:
- 3.27
-
getFields
Returns the ordered list of field declarations of this type declaration. For a class declaration, these are the field declarations; for an interface declaration, these are the constant declarations.This convenience method returns this node's body declarations with non-fields filtered out. Unlike
bodyDeclarations, this method does not return a live result.- Returns:
- the (possibly empty) list of field declarations
-
getMethods
Returns the ordered list of method declarations of this type declaration.This convenience method returns this node's body declarations with non-methods filtered out. Unlike
bodyDeclarations, this method does not return a live result.- Returns:
- the (possibly empty) list of method (and constructor) declarations
-
getTypes
Returns the ordered list of member type declarations of this type declaration.This convenience method returns this node's body declarations with non-types filtered out. Unlike
bodyDeclarations, this method does not return a live result.- Returns:
- the (possibly empty) list of member type declarations
-
setRestrictedIdentifierStartPosition
public void setRestrictedIdentifierStartPosition(int restrictedIdentifierStartPosition) A character index into the original restricted identifier source string, or-1if no restricted identifier source position information is available for this node;-1by default.- Since:
- 3.28
-
getRestrictedIdentifierStartPosition
public int getRestrictedIdentifierStartPosition()A character index into the original restricted identifier source string, or-1if no restricted identifier source position information is available for this node;-1by default.- Since:
- 3.28
-
MODIFIERS2_PROPERTY.