Package japa.parser.ast.expr

Examples of japa.parser.ast.expr.AnnotationExpr


            }
        }

        // Create the AnnotationExpr; it varies depending on how many
        // member-value pairs we need to present
        AnnotationExpr annotationExpression = null;
        if (memberValuePairs.isEmpty()) {
            annotationExpression = new MarkerAnnotationExpr(nameToUse);
        }
        else if (memberValuePairs.size() == 1
                && (memberValuePairs.get(0).getName() == null || "value"
View Full Code Here


    @SuppressWarnings("unchecked")
    private static MemberValuePair convert(
            final AnnotationAttributeValue<?> value) {
        if (value instanceof NestedAnnotationAttributeValue) {
            final NestedAnnotationAttributeValue castValue = (NestedAnnotationAttributeValue) value;
            AnnotationExpr annotationExpr;
            final AnnotationMetadata nestedAnnotation = castValue.getValue();
            if (castValue.getValue().getAttributeNames().size() == 0) {
                annotationExpr = new MarkerAnnotationExpr(
                        JavaParserUtils.getNameExpr(nestedAnnotation
                                .getAnnotationType()
View Full Code Here

        if (annotationName == null) {
            annotationName = new JavaSymbolName("__ARRAY_ELEMENT__");
        }

        if (expression instanceof AnnotationExpr) {
            final AnnotationExpr annotationExpr = (AnnotationExpr) expression;
            final AnnotationMetadata value = getInstance(annotationExpr,
                    compilationUnitServices).build();
            return new NestedAnnotationAttributeValue(annotationName, value);
        }
View Full Code Here

        throw new Error("Missing return statement in function");
    }

    final public PackageDeclaration PackageDeclaration() throws ParseException {
        List annotations = null;
        AnnotationExpr ann;
        NameExpr name;
        int line;
        int column;
        label_3: while (true) {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
View Full Code Here

    final public Modifier Modifiers() throws ParseException {
        int beginLine = -1;
        int beginColumn = -1;
        int modifiers = 0;
        List annotations = null;
        AnnotationExpr ann;
        label_4: while (true) {
            if (jj_2_2(2)) {
                ;
            } else {
                break label_4;
            }
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case PUBLIC:
                    jj_consume_token(PUBLIC);
                    modifiers = addModifier(modifiers, ModifierSet.PUBLIC, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case STATIC:
                    jj_consume_token(STATIC);
                    modifiers = addModifier(modifiers, ModifierSet.STATIC, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case PROTECTED:
                    jj_consume_token(PROTECTED);
                    modifiers = addModifier(modifiers, ModifierSet.PROTECTED, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case PRIVATE:
                    jj_consume_token(PRIVATE);
                    modifiers = addModifier(modifiers, ModifierSet.PRIVATE, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case FINAL:
                    jj_consume_token(FINAL);
                    modifiers = addModifier(modifiers, ModifierSet.FINAL, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case ABSTRACT:
                    jj_consume_token(ABSTRACT);
                    modifiers = addModifier(modifiers, ModifierSet.ABSTRACT, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case SYNCHRONIZED:
                    jj_consume_token(SYNCHRONIZED);
                    modifiers = addModifier(modifiers, ModifierSet.SYNCHRONIZED, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case NATIVE:
                    jj_consume_token(NATIVE);
                    modifiers = addModifier(modifiers, ModifierSet.NATIVE, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case TRANSIENT:
                    jj_consume_token(TRANSIENT);
                    modifiers = addModifier(modifiers, ModifierSet.TRANSIENT, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case VOLATILE:
                    jj_consume_token(VOLATILE);
                    modifiers = addModifier(modifiers, ModifierSet.VOLATILE, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case STRICTFP:
                    jj_consume_token(STRICTFP);
                    modifiers = addModifier(modifiers, ModifierSet.STRICTFP, token);
                    if (beginLine == -1) {
                        beginLine = token.beginLine;
                        beginColumn = token.beginColumn;
                    }
                    break;
                case AT:
                    ann = Annotation();
                    annotations = add(annotations, ann);
                    if (beginLine == -1) {
                        beginLine = ann.getBeginLine();
                        beginColumn = ann.getBeginColumn();
                    }
                    break;
                default:
                    jj_la1[6] = jj_gen;
                    jj_consume_token(-1);
View Full Code Here

        throw new Error("Missing return statement in function");
    }

    final public EnumConstantDeclaration EnumConstantDeclaration() throws ParseException {
        List annotations = null;
        AnnotationExpr ann;
        String name;
        List args = null;
        List classBody = null;
        int line = -1;
        int column = -1;
        pushJavadoc();
        label_9: while (true) {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case AT:
                    ;
                    break;
                default:
                    jj_la1[20] = jj_gen;
                    break label_9;
            }
            ann = Annotation();
            annotations = add(annotations, ann);
            if (line == -1) {
                line = ann.getBeginLine();
                column = ann.getBeginColumn();
            }
        }
        jj_consume_token(IDENTIFIER);
        name = token.image;
        if (line == -1) {
View Full Code Here

        jj_consume_token(GT);
    }

/* Annotation syntax follows. */
    final public AnnotationExpr Annotation() throws ParseException {
        AnnotationExpr ret;
        if (jj_2_40(2147483647)) {
            ret = NormalAnnotation();
        } else if (jj_2_41(2147483647)) {
            ret = SingleMemberAnnotation();
        } else {
View Full Code Here

      if (decl instanceof MethodDeclaration) {
        index = (MethodDeclaration)decl;
      }
    }
    Parameter param = index.getParameters().get(0);
    AnnotationExpr annotation = param.getAnnotations().get(0);
    param.getAnnotations().clear();
    file.assertSave();
//      helper.assertRemove("metamodel", "param", "A.java");

    // Recompile
View Full Code Here

   * @throws IOException
   */
  public static AnnotationExpr parseAnnotation(final String annotation)
      throws ParseException {
    StringReader sr = new StringReader(annotation);
    AnnotationExpr ae = new ASTParser(sr).Annotation();
    sr.close();
    return ae;
  }
View Full Code Here

            annotations.addAll(((AnnotableNode) node).getAnnotations());
            if (annotations.size()==0){
                return null;
            }
            sortByBeginPosition(annotations);
            AnnotationExpr lastAnnotation = annotations.get(annotations.size()-1);
            return lastAnnotation;
        } else {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of japa.parser.ast.expr.AnnotationExpr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.