public class AnnotationAttachment extends Object implements Node
Annotation
represents an Annotation node in Ballerina.
Annotation can be associated with various Ballerina concepts like Service, Resource, Functions, etc.
Modifier and Type | Class and Description |
---|---|
static class |
AnnotationAttachment.AnnotationBuilder
Builds an Annotation from parser events.
|
Constructor and Description |
---|
AnnotationAttachment(NodeLocation location,
WhiteSpaceDescriptor whiteSpaceDescriptor,
String name,
String pkgName,
String pkgPath,
Map<String,AnnotationAttributeValue> fieldValPairs) |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeNameValuePair(String name,
AnnotationAttributeValue value)
Add a attribute name-value pair for the annotation.
|
AnnotationAttachmentPoint |
getAttachedPoint()
Get the construct where this annotation is attached.
|
AnnotationAttributeValue |
getAttribute(String attributeName)
Get the value of the Key-Value pair.
|
Map<String,AnnotationAttributeValue> |
getAttributeNameValuePairs()
Get Key-Value pairs of fields in the annotation.
|
String |
getName()
Get name of the annotation.
|
NodeLocation |
getNodeLocation()
Returns the location of this node.
|
String |
getPkgName()
Get the package name of the annotation.
|
String |
getPkgPath()
Get the package path of the annotation.
|
String |
getValue()
Get value of an annotation with a single literal attribute.
|
WhiteSpaceDescriptor |
getWhiteSpaceDescriptor()
Get information about whitespace associated with this particular node in source file.
|
void |
setAttachedPoint(AnnotationAttachmentPoint attachedPoint)
Set the construct where this annotation is attached.
|
void |
setWhiteSpaceDescriptor(WhiteSpaceDescriptor whiteSpaceDescriptor)
Set the whitespace descriptor for this node.
|
String |
toString() |
public AnnotationAttachment(NodeLocation location, WhiteSpaceDescriptor whiteSpaceDescriptor, String name, String pkgName, String pkgPath, Map<String,AnnotationAttributeValue> fieldValPairs)
public String getName()
public String getPkgName()
public String getPkgPath()
public Map<String,AnnotationAttributeValue> getAttributeNameValuePairs()
public AnnotationAttributeValue getAttribute(String attributeName)
attributeName
- attribute namepublic NodeLocation getNodeLocation()
Node
NodeLocation
includes the source filename and the line number.
getNodeLocation
in interface Node
public void setWhiteSpaceDescriptor(WhiteSpaceDescriptor whiteSpaceDescriptor)
whiteSpaceDescriptor
- descriptorpublic WhiteSpaceDescriptor getWhiteSpaceDescriptor()
Node
getWhiteSpaceDescriptor
in interface Node
public void setAttachedPoint(AnnotationAttachmentPoint attachedPoint)
attachedPoint
- Where an annotation can be attachedpublic AnnotationAttachmentPoint getAttachedPoint()
public void addAttributeNameValuePair(String name, AnnotationAttributeValue value)
name
- Name of the attributevalue
- Value of the attributepublic String getValue()
Copyright © 2018 WSO2. All rights reserved.