@Override public boolean matches(final INode other, final Match match) { if (other instanceof Annotation) { final Annotation otherAnnotation = (Annotation) other; return !otherAnnotation.isNull() && getType().matches(otherAnnotation.getType(), match) && getArguments().matches(otherAnnotation.getArguments(), match); } return false; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof Annotation) { final Annotation otherAnnotation = (Annotation) other; return !otherAnnotation.isNull() && getType().matches(otherAnnotation.getType(), match) && getArguments().matches(otherAnnotation.getArguments(), match); } return false; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof Annotation) { final Annotation otherAnnotation = (Annotation) other; return !otherAnnotation.isNull() && getType().matches(otherAnnotation.getType(), match) && getArguments().matches(otherAnnotation.getArguments(), match); } return false; }
public Annotation createAnnotation(final CustomAnnotation annotation) { final Annotation a = new Annotation(); final AstNodeCollection<Expression> arguments = a.getArguments(); a.setType(convertType(annotation.getAnnotationType())); final List<AnnotationParameter> parameters = annotation.getParameters(); for (final AnnotationParameter p : parameters) { final String member = p.getMember(); final Expression value = createAnnotationElement(p.getValue()); if (StringUtilities.isNullOrEmpty(member) || parameters.size() == 1 && "value".equals(member)) { arguments.add(value); } else { arguments.add(new AssignmentExpression(new IdentifierExpression(value.getOffset(), member), value)); } } return a; }
public Annotation createAnnotation(final CustomAnnotation annotation) { final Annotation a = new Annotation(); final AstNodeCollection<Expression> arguments = a.getArguments(); a.setType(convertType(annotation.getAnnotationType())); final List<AnnotationParameter> parameters = annotation.getParameters(); for (final AnnotationParameter p : parameters) { final String member = p.getMember(); final Expression value = createAnnotationElement(p.getValue()); if (StringUtilities.isNullOrEmpty(member) || parameters.size() == 1 && "value".equals(member)) { arguments.add(value); } else { arguments.add(new AssignmentExpression(new IdentifierExpression(value.getOffset(), member), value)); } } return a; }
public Annotation createAnnotation(final CustomAnnotation annotation) { final Annotation a = new Annotation(); final AstNodeCollection<Expression> arguments = a.getArguments(); a.setType(convertType(annotation.getAnnotationType())); final List<AnnotationParameter> parameters = annotation.getParameters(); for (final AnnotationParameter p : parameters) { final String member = p.getMember(); final Expression value = createAnnotationElement(p.getValue()); if (StringUtilities.isNullOrEmpty(member) || parameters.size() == 1 && "value".equals(member)) { arguments.add(value); } else { arguments.add(new AssignmentExpression(new IdentifierExpression(value.getOffset(), member), value)); } } return a; }
@Override public Void visitAnnotation(final Annotation node, final Void ignored) { startNode(node); startNode(node.getType()); formatter.writeIdentifier("@"); endNode(node.getType()); node.getType().acceptVisitor(this, ignored); final AstNodeCollection<Expression> arguments = node.getArguments(); if (!arguments.isEmpty()) { writeCommaSeparatedListInParenthesis(arguments, false); } endNode(node); return null; }
@Override public Void visitAnnotation(final Annotation node, final Void ignored) { startNode(node); startNode(node.getType()); formatter.writeIdentifier("@"); endNode(node.getType()); node.getType().acceptVisitor(this, ignored); final AstNodeCollection<Expression> arguments = node.getArguments(); if (!arguments.isEmpty()) { writeCommaSeparatedListInParenthesis(arguments, false); } endNode(node); return null; }
@Override public Void visitAnnotation(final Annotation node, final Void ignored) { startNode(node); startNode(node.getType()); formatter.writeIdentifier("@"); endNode(node.getType()); node.getType().acceptVisitor(this, ignored); final AstNodeCollection<Expression> arguments = node.getArguments(); if (!arguments.isEmpty()) { writeCommaSeparatedListInParenthesis(arguments, false); } endNode(node); return null; }