Package org.jboss.forge.parser.java

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


                  .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

         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

      Resource<URL> templateResource = resourceFactory.create(getClass().getResource("Endpoint.jv"));
      TemplateProcessor processor = processorFactory.fromTemplate(new FreemarkerTemplate(templateResource));
      String output = processor.process(map);
      JavaClass resource = JavaParser.parse(JavaClass.class, output);
      resource.addImport(entity.getQualifiedName());
      resource.setPackage(context.getTargetPackageName());
      return Arrays.asList(resource);
   }

   @Override
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

      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());
         }
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<JavaClass> manyAnnotation = 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

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.