Package org.jboss.forge.parser.java

Examples of org.jboss.forge.parser.java.JavaClass.addImport()


         map.put("setIdStatement", idSetterName);
         map.put("contentType", contentType);
         map.put("entityTable", getEntityTable(entity));

         JavaClass endpoint = JavaParser.parse(JavaClass.class, template.render(map));
         endpoint.addImport(entity.getQualifiedName());
         endpoint.setPackage(java.getBasePackage() + ".rest");
         endpoint.getAnnotation(Path.class).setStringValue("/" + getEntityTable(entity).toLowerCase());

         /*
         * Save the sources
View Full Code Here


         if (!Strings.isNullOrEmpty(inverseFieldName))
         {
            annotation.setStringValue("mappedBy", inverseFieldName);

            otherEntity.addImport(Set.class);
            otherEntity.addImport(HashSet.class);
            if (!otherEntity.getCanonicalName().equals(entity.getCanonicalName()))
            {
               otherEntity.addImport(entity.getQualifiedName());
            }
            Field<JavaClass> otherField = otherEntity.addField("private Set<" + entity.getName() + "> "
View Full Code Here

            otherEntity.addImport(Set.class);
            otherEntity.addImport(HashSet.class);
            if (!otherEntity.getCanonicalName().equals(entity.getCanonicalName()))
            {
               otherEntity.addImport(entity.getQualifiedName());
            }
            Field<JavaClass> otherField = otherEntity.addField("private Set<" + entity.getName() + "> "
                     + inverseFieldName
                     + "= new HashSet<" + entity.getName() + ">();");
            otherField.addAnnotation(ManyToMany.class);
View Full Code Here

            annotation.setLiteralValue("cascade", "CascadeType.ALL");
            annotation.getOrigin().addImport(CascadeType.class);
            annotation.setLiteralValue("orphanRemoval", "true");
            if (!many.getCanonicalName().equals(one.getCanonicalName()))
            {
               many.addImport(one);
            }
            Field<JavaClass> manyField = many.addField("private " + one.getName() + " " + inverseFieldName + ";");
            manyField.addAnnotation(ManyToOne.class);
            Refactory.createGetterAndSetter(many, manyField);
            java.saveJavaSource(many);
View Full Code Here

         manyField.addAnnotation(ManyToOne.class);
         Refactory.createGetterAndSetter(many, manyField);

         if (!Strings.isNullOrEmpty(inverseFieldName))
         {
            one.addImport(Set.class);
            one.addImport(HashSet.class);
            if (!one.getCanonicalName().equals(many.getCanonicalName()))
            {
               one.addImport(many.getQualifiedName());
            }
View Full Code Here

         Refactory.createGetterAndSetter(many, manyField);

         if (!Strings.isNullOrEmpty(inverseFieldName))
         {
            one.addImport(Set.class);
            one.addImport(HashSet.class);
            if (!one.getCanonicalName().equals(many.getCanonicalName()))
            {
               one.addImport(many.getQualifiedName());
            }
            Field<JavaClass> oneField = one.addField("private Set<" + many.getName() + "> " + inverseFieldName
View Full Code Here

         {
            one.addImport(Set.class);
            one.addImport(HashSet.class);
            if (!one.getCanonicalName().equals(many.getCanonicalName()))
            {
               one.addImport(many.getQualifiedName());
            }
            Field<JavaClass> oneField = one.addField("private Set<" + many.getName() + "> " + inverseFieldName
                     + "= new HashSet<"
                     + many.getName() + ">();");
            Annotation<JavaClass> oneAnnotation = oneField.addAnnotation(OneToMany.class).setStringValue("mappedBy",
View Full Code Here

         String entityTable = getEntityTable(entity);
         map.put("entityTable", entityTable);
         map.put("resourcePath", entityTable.toLowerCase() + "s");

         JavaClass resource = JavaParser.parse(JavaClass.class, template.render(map));
         resource.addImport(entity.getQualifiedName());
         resource.setPackage(java.getBasePackage() + ".rest");

         /*
          * Save the sources
          */
 
View Full Code Here

                  .setPackage(classPackage)
                  .setName(className)
                  .setSuperType("javax.ws.rs.core.Application")
                  .addAnnotation("javax.ws.rs.ApplicationPath").setStringValue(rootPath).getOrigin();

         applicationClass.addImport("javax.ws.rs.core.Application");
         applicationClass.addImport("javax.ws.rs.ApplicationPath");

         try
         {
            javaSourceFacet.saveJavaSource(applicationClass);
View Full Code Here

                  .setName(className)
                  .setSuperType("javax.ws.rs.core.Application")
                  .addAnnotation("javax.ws.rs.ApplicationPath").setStringValue(rootPath).getOrigin();

         applicationClass.addImport("javax.ws.rs.core.Application");
         applicationClass.addImport("javax.ws.rs.ApplicationPath");

         try
         {
            javaSourceFacet.saveJavaSource(applicationClass);
         }
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.