Package japa.parser.ast.body

Examples of japa.parser.ast.body.JavadocComment


public class CompilationUnitBuilder {

    private CompilationUnit cu = new CompilationUnit();

    public CompilationUnitBuilder buildComment(String commentStr) {
        JavadocComment comment = new JavadocComment(commentStr);
        cu.setComment(comment);
        return this;
    }
View Full Code Here


    public ClassTypeBuilder(String clazzName) {
        type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, false, clazzName);
    }

    public ClassTypeBuilder buildComment(String commentStr) {
        JavadocComment comment = new JavadocComment(commentStr);
        type.setComment(comment);
        return this;
    }
View Full Code Here

    extended.add(new ClassOrInterfaceType(informerInfos.getAbstractInformerName()));
    if(informerInfos.superClassName!=null && !"Object".equals(informerInfos.superClassName)) {
      extended.add(new ClassOrInterfaceType(InformerInfos.buildAbstractInformerName(informerInfos.superClassName)));
    }
    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"));
    List<AnnotationExpr> annotations = new LinkedList<AnnotationExpr>();
    // Constructing generated annotation value
View Full Code Here

    if(informerInfos.superClassName!=null && !"Object".equals(informerInfos.superClassName)) {
      List<ClassOrInterfaceType> extended = new LinkedList<ClassOrInterfaceType>();
      extended.add(new ClassOrInterfaceType(InformerInfos.buildAbstractInformerName(informerInfos.superClassName)));
      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);
    imports.remove("java.lang");
View Full Code Here

    }

    // 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);
    imports.remove("java.lang");
View Full Code Here

    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"));
    List<AnnotationExpr> annotations = new LinkedList<AnnotationExpr>();
    // Constructing generated annotation value
View Full Code Here

        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);
    imports.remove("java.lang");
View Full Code Here

public class CompilationUnitBuilder {

    private CompilationUnit cu = new CompilationUnit();

    public CompilationUnitBuilder buildComment(String commentStr) {
        Comment comment = new JavadocComment(commentStr);
        if (null != cu.getComments()) {
            cu.getComments().add(comment);
        } else {
            cu.setComment(comment);
        }
View Full Code Here

    public ClassTypeBuilder(String clazzName) {
        type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, false, clazzName);
    }

    public ClassTypeBuilder buildComment(String commentStr) {
        JavadocComment comment = new JavadocComment(commentStr);
        type.setComment(comment);
        return this;
    }
View Full Code Here

        return Boolean.TRUE;
    }

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

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

        return Boolean.TRUE;
    }
View Full Code Here

TOP

Related Classes of japa.parser.ast.body.JavadocComment

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.