Interface TypeDecl
-
- All Superinterfaces:
ASTNode
- All Known Implementing Classes:
ClassDecl,EnumDecl,InterfaceDecl
public interface TypeDecl extends ASTNode
A declared type in the source AST - class, interface, enum or annotation - exposing its modifiers, annotations and members.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description NodeList<AnnotationExpr>getAnnotations()default FieldDeclgetField(String name)Finds a declared field by name.NodeList<FieldDecl>getFields()default TypeDeclgetInnerType(String name)Finds a directly nested type by simple name.NodeList<TypeDecl>getInnerTypes()default MethodDeclgetMethod(String name)Finds a declared method by name, ignoring the descriptor.NodeList<MethodDecl>getMethods()Set<Modifier>getModifiers()StringgetName()default booleanisAbstract()default booleanisFinal()default booleanisPrivate()default booleanisProtected()default booleanisPublic()default booleanisStatic()-
Methods inherited from interface com.tonic.analysis.source.ast.ASTNode
accept, deepClone, findAll, findAll, findAncestor, findFirst, findFirst, getChildren, getLocation, getParent, getRoot, isDescendantOf, remove, replaceWith, setParent, stream, stream, walk
-
-
-
-
Method Detail
-
getName
String getName()
- Returns:
- the simple type name
-
getAnnotations
NodeList<AnnotationExpr> getAnnotations()
- Returns:
- the annotations on the declaration
-
getMethods
NodeList<MethodDecl> getMethods()
- Returns:
- the declared methods
-
isPublic
default boolean isPublic()
- Returns:
- true when the type is declared public
-
isProtected
default boolean isProtected()
- Returns:
- true when the type is declared protected
-
isPrivate
default boolean isPrivate()
- Returns:
- true when the type is declared private
-
isStatic
default boolean isStatic()
- Returns:
- true when the type is declared static
-
isFinal
default boolean isFinal()
- Returns:
- true when the type is declared final
-
isAbstract
default boolean isAbstract()
- Returns:
- true when the type is declared abstract
-
getMethod
default MethodDecl getMethod(String name)
Finds a declared method by name, ignoring the descriptor.- Parameters:
name- the method name to match- Returns:
- the first method with that name, or null when none has it
-
getField
default FieldDecl getField(String name)
Finds a declared field by name.- Parameters:
name- the field name to match- Returns:
- the matching field, or null when there is none
-
-