Class InterfaceDecl
- java.lang.Object
-
- com.tonic.analysis.source.ast.decl.InterfaceDecl
-
-
Constructor Summary
Constructors Constructor Description InterfaceDecl(String name)Creates an interface with no source position.InterfaceDecl(String name, SourceLocation location)Creates an interface with no modifiers or members.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(SourceVisitor<T> visitor)Accepts a visitor for this node.InterfaceDecladdAnnotation(AnnotationExpr annotation)Appends an annotation.InterfaceDecladdExtendedInterface(SourceType iface)Appends a super-interface to the extends clause.InterfaceDecladdField(FieldDecl field)Appends a field.InterfaceDecladdInnerType(TypeDecl innerType)Appends a nested type.InterfaceDecladdMethod(MethodDecl method)Appends a method.InterfaceDecladdModifier(Modifier modifier)Adds one modifier.InterfaceDecladdTypeParameter(SourceType typeParam)Appends a type parameter.NodeList<AnnotationExpr>getAnnotations()List<ASTNode>getChildren()Lists the direct children a node holds, in source order.NodeList<SourceType>getExtendedInterfaces()NodeList<FieldDecl>getFields()NodeList<TypeDecl>getInnerTypes()SourceLocationgetLocation()Gets the source location of this node.NodeList<MethodDecl>getMethods()Set<Modifier>getModifiers()StringgetName()ASTNodegetParent()Gets the parent node in the AST tree.NodeList<SourceType>getTypeParameters()voidsetName(String name)Renames the interface.voidsetParent(ASTNode parent)Records the node this declaration hangs under.StringtoString()InterfaceDeclwithModifiers(Set<Modifier> modifiers)Replaces the modifier set.InterfaceDeclwithName(String name)Renames the interface.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tonic.analysis.source.ast.ASTNode
deepClone, findAll, findAll, findAncestor, findFirst, findFirst, getRoot, isDescendantOf, remove, replaceWith, stream, stream, walk
-
Methods inherited from interface com.tonic.analysis.source.ast.decl.TypeDecl
getField, getInnerType, getMethod, isAbstract, isFinal, isPrivate, isProtected, isPublic, isStatic
-
-
-
-
Constructor Detail
-
InterfaceDecl
public InterfaceDecl(String name, SourceLocation location)
Creates an interface with no modifiers or members.- Parameters:
name- the simple namelocation- the source position, or null for UNKNOWN
-
InterfaceDecl
public InterfaceDecl(String name)
Creates an interface with no source position.- Parameters:
name- the simple name
-
-
Method Detail
-
setName
public void setName(String name)
Renames the interface.- Parameters:
name- the new simple name
-
getModifiers
public Set<Modifier> getModifiers()
- Specified by:
getModifiersin interfaceTypeDecl- Returns:
- the modifiers
-
getAnnotations
public NodeList<AnnotationExpr> getAnnotations()
- Specified by:
getAnnotationsin interfaceTypeDecl- Returns:
- the annotations
-
getExtendedInterfaces
public NodeList<SourceType> getExtendedInterfaces()
- Returns:
- the extended interfaces
-
getTypeParameters
public NodeList<SourceType> getTypeParameters()
- Returns:
- the type parameters
-
getMethods
public NodeList<MethodDecl> getMethods()
- Specified by:
getMethodsin interfaceTypeDecl- Returns:
- the methods
-
getInnerTypes
public NodeList<TypeDecl> getInnerTypes()
- Specified by:
getInnerTypesin interfaceTypeDecl- Returns:
- the inner types
-
getLocation
public SourceLocation getLocation()
Description copied from interface:ASTNodeGets the source location of this node.- Specified by:
getLocationin interfaceASTNode- Returns:
- the location
-
getParent
public ASTNode getParent()
Description copied from interface:ASTNodeGets the parent node in the AST tree.
-
setParent
public void setParent(ASTNode parent)
Records the node this declaration hangs under.
-
withName
public InterfaceDecl withName(String name)
Renames the interface.- Parameters:
name- the new simple name- Returns:
- this declaration
-
withModifiers
public InterfaceDecl withModifiers(Set<Modifier> modifiers)
Replaces the modifier set.- Parameters:
modifiers- the modifiers to hold- Returns:
- this declaration
-
addModifier
public InterfaceDecl addModifier(Modifier modifier)
Adds one modifier.- Parameters:
modifier- the modifier to add- Returns:
- this declaration
-
addAnnotation
public InterfaceDecl addAnnotation(AnnotationExpr annotation)
Appends an annotation.- Parameters:
annotation- the annotation to add- Returns:
- this declaration
-
addExtendedInterface
public InterfaceDecl addExtendedInterface(SourceType iface)
Appends a super-interface to the extends clause.- Parameters:
iface- the interface type to add- Returns:
- this declaration
-
addTypeParameter
public InterfaceDecl addTypeParameter(SourceType typeParam)
Appends a type parameter.- Parameters:
typeParam- the type parameter to add- Returns:
- this declaration
-
addField
public InterfaceDecl addField(FieldDecl field)
Appends a field.- Parameters:
field- the field to add- Returns:
- this declaration
-
addMethod
public InterfaceDecl addMethod(MethodDecl method)
Appends a method.- Parameters:
method- the method to add- Returns:
- this declaration
-
addInnerType
public InterfaceDecl addInnerType(TypeDecl innerType)
Appends a nested type.- Parameters:
innerType- the nested declaration to add- Returns:
- this declaration
-
getChildren
public List<ASTNode> getChildren()
Description copied from interface:ASTNodeLists the direct children a node holds, in source order.- Specified by:
getChildrenin interfaceASTNode- Returns:
- the direct children, empty for a leaf
-
accept
public <T> T accept(SourceVisitor<T> visitor)
Description copied from interface:ASTNodeAccepts a visitor for this node.
-
-