Package japa.parser.ast.type

Examples of japa.parser.ast.type.ClassOrInterfaceType


        return Boolean.TRUE;
    }

    public Boolean visit(ClassOrInterfaceType n1, Node arg) {
        ClassOrInterfaceType n2 = (ClassOrInterfaceType) arg;

        if (!objEquals(n1.getName(), n2.getName())) {
            return Boolean.FALSE;
        }

        if (!nodeEquals(n1.getScope(), n2.getScope())) {
            return Boolean.FALSE;
        }

        if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
            return Boolean.FALSE;
        }

        return Boolean.TRUE;
    }
View Full Code Here


        printTypeParameters(n.getTypeParameters(), arg);

        if (n.getExtends() != null) {
            printer.print(" extends ");
            for (Iterator<ClassOrInterfaceType> i = n.getExtends().iterator(); i.hasNext();) {
                ClassOrInterfaceType c = i.next();
                c.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(", ");
                }
            }
        }

        if (n.getImplements() != null) {
            printer.print(" implements ");
            for (Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext();) {
                ClassOrInterfaceType c = i.next();
                c.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(", ");
                }
            }
        }
View Full Code Here

    public void visit(TypeParameter n, Object arg) {
        printer.print(n.getName());
        if (n.getTypeBound() != null) {
            printer.print(" extends ");
            for (Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext();) {
                ClassOrInterfaceType c = i.next();
                c.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(" & ");
                }
            }
        }
View Full Code Here

        printer.print(n.getName());

        if (n.getImplements() != null) {
            printer.print(" implements ");
            for (Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext();) {
                ClassOrInterfaceType c = i.next();
                c.accept(this, arg);
                if (i.hasNext()) {
                    printer.print(", ");
                }
            }
        }
View Full Code Here

    }

    final public List ExtendsList(boolean isInterface) throws ParseException {
        boolean extendsMoreThanOne = false;
        List ret = new LinkedList();
        ClassOrInterfaceType cit;
        jj_consume_token(EXTENDS);
        cit = ClassOrInterfaceType();
        ret.add(cit);
        label_5: while (true) {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
View Full Code Here

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

    final public List ImplementsList(boolean isInterface) throws ParseException {
        List ret = new LinkedList();
        ClassOrInterfaceType cit;
        jj_consume_token(IMPLEMENTS);
        cit = ClassOrInterfaceType();
        ret.add(cit);
        label_6: while (true) {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
View Full Code Here

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

    final public List TypeBound() throws ParseException {
        List ret = new LinkedList();
        ClassOrInterfaceType cit;
        jj_consume_token(EXTENDS);
        cit = ClassOrInterfaceType();
        ret.add(cit);
        label_11: while (true) {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
View Full Code Here

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

    final public ClassOrInterfaceType ClassOrInterfaceType() throws ParseException {
        ClassOrInterfaceType ret;
        String name;
        List typeArgs = null;
        int line;
        int column;
        jj_consume_token(IDENTIFIER);
        line = token.beginLine;
        column = token.beginColumn;
        name = token.image;
        if (jj_2_14(2)) {
            typeArgs = TypeArguments();
            typeArgs.remove(0);
        } else {
            ;
        }
        ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn, null, name, typeArgs);
        label_21: while (true) {
            if (jj_2_15(2)) {
                ;
            } else {
                break label_21;
            }
            jj_consume_token(DOT);
            jj_consume_token(IDENTIFIER);
            name = token.image;
            if (jj_2_16(2)) {
                typeArgs = TypeArguments();
                typeArgs.remove(0);
            } else {
                ;
            }
            ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn, ret, name, typeArgs);
        }
        {
            if (true) {
                return ret;
            }
View Full Code Here

      imports.add(d.getName().toString());
    }

    // create the type declaration
    ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, true, informerInfos.getInformerName());
    type.setExtends(Arrays.asList(new ClassOrInterfaceType(Informer.class.getSimpleName() + "<" + informerInfos.className + ">")));
    type.setJavaDoc(new JavadocComment("\n" + "Informer for {@link " + informerInfos.className + "}\n" + "@author InformerMojos\n"));
    ASTHelper.addTypeDeclaration(cu, type);
    for (PropertyInfos infos : informerInfos.properties) {
      // create a method
      MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC, ASTHelper.VOID_TYPE, "get" + Utils.uppercaseFirst(infos.name));
      String informerTypeFor = InformerTypeFinder.getInformerTypeFor(resolvedInformers, qualifiedEnums, imports, infos);
      method.setType(new ClassOrInterfaceType(informerTypeFor));
      method.setJavaDoc(new JavadocComment(infos.generateJavadoc(informerInfos, informerTypeFor)));
      ASTHelper.addMember(type, method);
    }
   
    imports.remove(informerInfos.classPackage);
View Full Code Here

      imports.add(d.getName().toString());
    }

    // create the type declaration
    ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, true, informerInfos.getInformerName());
    type.setExtends(Arrays.asList(new ClassOrInterfaceType(Informer.class.getSimpleName() + "<" + informerInfos.className + ">")));
    type.setJavaDoc(new JavadocComment("\n" + "Informer for {@link " + informerInfos.className + "}\n" + "@author InformerMojos\n"));
    List<AnnotationExpr> annotations = new LinkedList<AnnotationExpr>();
    // Constructing generated annotation value
    List<MemberValuePair> parameters = new LinkedList<MemberValuePair>();
    parameters.add(new MemberValuePair("date", new StringLiteralExpr(
            javax.xml.bind.DatatypeConverter.printDateTime(GregorianCalendar.getInstance()))));
    parameters.add(new MemberValuePair("comments", new StringLiteralExpr("generated by gaedo-informer-generator")));
    List<Expression> values = new LinkedList<Expression>();
    values.add(new StringLiteralExpr(informerInfos.getQualifiedClassName()));
    parameters.add(new MemberValuePair("value",
            new ArrayInitializerExpr(values)));
    NormalAnnotationExpr generated = new NormalAnnotationExpr(ASTHelper.createNameExpr(Generated.class.getName()), parameters);
    type.setAnnotations(annotations);
    ASTHelper.addTypeDeclaration(cu, type);
    for (PropertyInfos infos : informerInfos.properties) {
      // create a method
      MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC, ASTHelper.VOID_TYPE, "get" + Utils.uppercaseFirst(infos.name));
      String informerTypeFor = InformerTypeFinder.getInformerTypeFor(resolvedInformers, qualifiedEnums, imports, infos);
      method.setType(new ClassOrInterfaceType(informerTypeFor));
      method.setJavaDoc(new JavadocComment(infos.generateJavadoc(informerInfos, informerTypeFor)));
      ASTHelper.addMember(type, method);
    }
   
    imports.remove(informerInfos.classPackage);
View Full Code Here

TOP

Related Classes of japa.parser.ast.type.ClassOrInterfaceType

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.