Examples of ClassOrInterfaceType


Examples of japa.parser.ast.type.ClassOrInterfaceType

    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

Examples of japa.parser.ast.type.ClassOrInterfaceType

     * @param arrayCount
     *            number os arrays or <code>0</code> if is not a array.
     * @return instanceof {@link ReferenceType}
     */
    public static ReferenceType createReferenceType(String name, int arrayCount) {
        return new ReferenceType(new ClassOrInterfaceType(name), arrayCount);
    }
View Full Code Here

Examples of japa.parser.ast.type.ClassOrInterfaceType

      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.className, informerTypeFor)));
      ASTHelper.addMember(type, method);
    }
   
    imports.remove(informerInfos.classPackage);
View Full Code Here

Examples of japa.parser.ast.type.ClassOrInterfaceType

    }

    // create the type declaration
    ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, true, informerInfos.getInformerName());
    List<ClassOrInterfaceType> extended = new LinkedList<ClassOrInterfaceType>();
    extended.add(new ClassOrInterfaceType(Informer.class.getSimpleName() + "<" + informerInfos.className + ">"));
    extended.add(new ClassOrInterfaceType(informerInfos.getAbstractInformerName()));
    type.setExtends(extended);
    type.setJavaDoc(new JavadocComment("\n" +
            "Informer for {@link " + informerInfos.className + "}\n" +
            "This is the public Informer class one must use to access dynamic properties methods." +
            "@author InformerMojos\n"));
View Full Code Here

Examples of japa.parser.ast.type.ClassOrInterfaceType

      String superInformer = InformerInfos.buildAbstractInformerName(informerInfos.superClassName);
      // do not forget to add import for that class (see https://github.com/Riduidel/gaedo/issues/20)
      if(superClassPackage!=null) {
        imports.add(superClassPackage+"."+superInformer);
      }
      extended.add(new ClassOrInterfaceType(superInformer));
      type.setExtends(extended);
    }
    type.setJavaDoc(new JavadocComment("\n" +
            "Informer method container for {@link " + informerInfos.className + "}\n" +
            "This interface is to be used only by gaedo code. Its only role is to provide consistent method hierarchy.\n" +
            "As a consequence, refering to it directly has not the slightest interest and should never been done in user code." +
            "@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);
    annotations.add(generated);
    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

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

Examples of japa.parser.ast.type.ClassOrInterfaceType

        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

Examples of japa.parser.ast.type.ClassOrInterfaceType

    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

Examples of japa.parser.ast.type.ClassOrInterfaceType

        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

Examples of japa.parser.ast.type.ClassOrInterfaceType

    }

    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
TOP
Copyright © 2018 www.massapi.com. 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.