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; }
private void addAnnotation( final EntityDeclaration node, final IMetadataResolver resolver, final String annotationName) { if (resolver == null) { return; } final Annotation annotation = new Annotation(); final TypeReference annotationType = new MetadataParser(resolver).parseTypeDescriptor(annotationName); if (_astBuilder != null) { annotation.setType(_astBuilder.convertType(annotationType)); } else { annotation.setType(new SimpleType(annotationType.getSimpleName())); } node.getAnnotations().add(annotation); } }
final Annotation annotation = new Annotation();
final Annotation annotation = new Annotation();
final Annotation annotation = new Annotation();