Class AnnotationValue
- java.lang.Object
-
- com.tonic.analysis.source.ast.decl.AnnotationValue
-
-
Constructor Summary
Constructors Constructor Description AnnotationValue(String name, Expression value)Creates an element-value pair at an unknown location.AnnotationValue(String name, Expression value, SourceLocation location)Creates an element-value pair, adopting the value expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(SourceVisitor<T> visitor)Accepts a visitor for this node.List<ASTNode>getChildren()Lists the direct children a node holds, in source order.SourceLocationgetLocation()Gets the source location of this node.StringgetName()ASTNodegetParent()Gets the parent node in the AST tree.ExpressiongetValue()voidsetName(String name)Sets the element name.voidsetParent(ASTNode parent)Sets the parent node.voidsetValue(Expression value)Sets the element value.StringtoString()AnnotationValuewithName(String name)Sets the element name.AnnotationValuewithValue(Expression value)Replaces the element value, adopting the new expression and releasing the old one.-
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
-
-
-
-
Constructor Detail
-
AnnotationValue
public AnnotationValue(String name, Expression value, SourceLocation location)
Creates an element-value pair, adopting the value expression.- Parameters:
name- the element namevalue- the element valuelocation- the source location, or null for unknown
-
AnnotationValue
public AnnotationValue(String name, Expression value)
Creates an element-value pair at an unknown location.- Parameters:
name- the element namevalue- the element value
-
-
Method Detail
-
getName
public String getName()
- Returns:
- the name
-
setName
public void setName(String name)
Sets the element name.- Parameters:
name- the element name
-
getValue
public Expression getValue()
- Returns:
- the value
-
setValue
public void setValue(Expression value)
Sets the element value.- Parameters:
value- the element value
-
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)
Sets the parent node.
-
withName
public AnnotationValue withName(String name)
Sets the element name.- Parameters:
name- the element name- Returns:
- this pair
-
withValue
public AnnotationValue withValue(Expression value)
Replaces the element value, adopting the new expression and releasing the old one.- Parameters:
value- the element value- Returns:
- this pair
-
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.
-
-