public Node createAnnotationElement(Node name, Node value) { return posify(new AnnotationElement().astName(createIdentifierIfNeeded(name, currentPos())).rawValue(value)); }
@CopyMethod static List<Node> getValues(Annotation self, String key) { for (AnnotationElement elem : self.astElements()) { if (key == null && elem.astName() == null) return elem.getValues(); if (key != null && elem.astName() != null && elem.astName().astValue().equals(key)) return elem.getValues(); } return ImmutableList.of(); } }
@Override public void visitMemberValuePair(MemberValuePair node) { lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astName(toIdentifier(node.name, node.sourceStart, node.sourceEnd)); element.astValue((lombok.ast.AnnotationValue) toTree(node.value)); set(node, setPosition(node, element)); }
@Override public void visitSingleMemberAnnotation(SingleMemberAnnotation node) { lombok.ast.Annotation annot = createAnnotation(node); lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astValue((lombok.ast.AnnotationValue) toTree(node.memberValue)); annot.astElements().addToEnd(element); annot.setPosition(toPosition(node.sourceStart, node.declarationSourceEnd)); set(node, annot); }
public Node createAnnotationFromElement(Node value) { Annotation result = new Annotation(); if (value != null) { result.rawElements().addToEnd(posify(new AnnotationElement().rawValue(value))); } return posify(result); }
if (parent instanceof VariableDefinition) { for (AnnotationElement element : node.astElements()) { AnnotationValue valueNode = element.astValue(); if (valueNode == null) { continue;
@CopyMethod static String getDescription(AnnotationElement self) { try { return self.astName().astValue(); } catch (NullPointerException e) { return null; } }
@CopyMethod static List<Node> getValues(AnnotationElement self) { if (self.rawValue() == null) return ImmutableList.of(); if (self.rawValue() instanceof AnnotationValueArray) { ImmutableList.Builder<Node> result = ImmutableList.builder(); for (Node n : ((AnnotationValueArray)self.rawValue()).rawValues()) result.add(n); return result.build(); } return ImmutableList.of(self.rawValue()); } }
@Override public void visitMemberValuePair(MemberValuePair node) { lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astName(toIdentifier(node.name, node.sourceStart, node.sourceEnd)); element.astValue((lombok.ast.AnnotationValue) toTree(node.value)); set(node, setPosition(node, element)); }
@Override public void visitSingleMemberAnnotation(SingleMemberAnnotation node) { lombok.ast.Annotation annot = createAnnotation(node); lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astValue((lombok.ast.AnnotationValue) toTree(node.memberValue)); annot.astElements().addToEnd(element); annot.setPosition(toPosition(node.sourceStart, node.declarationSourceEnd)); set(node, annot); }
public Node createAnnotationFromElement(Node value) { Annotation result = new Annotation(); if (value != null) { result.rawElements().addToEnd(posify(new AnnotationElement().rawValue(value))); } return posify(result); }
if (values != null) { for (AnnotationElement element : values) { AnnotationValue valueNode = element.astValue(); if (valueNode == null) { continue;
@CopyMethod static String getDescription(AnnotationElement self) { try { return self.astName().astValue(); } catch (NullPointerException e) { return null; } }
@CopyMethod static List<Node> getValues(AnnotationElement self) { if (self.rawValue() == null) return ImmutableList.of(); if (self.rawValue() instanceof AnnotationValueArray) { ImmutableList.Builder<Node> result = ImmutableList.builder(); for (Node n : ((AnnotationValueArray)self.rawValue()).rawValues()) result.add(n); return result.build(); } return ImmutableList.of(self.rawValue()); } }
public Node createAnnotationElement(Node name, Node value) { return posify(new AnnotationElement().astName(createIdentifierIfNeeded(name, currentPos())).rawValue(value)); }
@Override public void visitMemberValuePair(MemberValuePair node) { lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astName(toIdentifier(node.name, node.sourceStart, node.sourceEnd)); element.astValue((lombok.ast.AnnotationValue) toTree(node.value)); set(node, setPosition(node, element)); }
@CopyMethod static List<Node> getValues(Annotation self, String key) { for (AnnotationElement elem : self.astElements()) { if (key == null && elem.astName() == null) return elem.getValues(); if (key != null && elem.astName() != null && elem.astName().astValue().equals(key)) return elem.getValues(); } return ImmutableList.of(); } }
@Override public void visitSingleMemberAnnotation(SingleMemberAnnotation node) { lombok.ast.Annotation annot = createAnnotation(node); lombok.ast.AnnotationElement element = new lombok.ast.AnnotationElement(); element.astValue((lombok.ast.AnnotationValue) toTree(node.memberValue)); annot.astElements().addToEnd(element); annot.setPosition(toPosition(node.sourceStart, node.declarationSourceEnd)); set(node, annot); }