Package org.jboss.forge.addon.parser.java.facets

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet.saveJavaSource()


   public JavaResource newEntity(Project project, String entityName, String entityPackage, GenerationType idStrategy)
            throws FileNotFoundException
   {
      final JavaSourceFacet java = facetFactory.install(project, JavaSourceFacet.class);
      JavaClass javaClass = createJavaClass(entityName, entityPackage, idStrategy);
      return java.saveJavaSource(javaClass);
   }

   /**
    * Creates a new {@link JavaResource} in the specified target. If a project is available, use
    * {@link PersistenceOperations#newEntity(Project, String, String, GenerationType)}
View Full Code Here


      if ((inverseFieldName != null) && !inverseFieldName.isEmpty())
      {
         Field<JavaClass> inverseField = addFieldTo(fieldEntityClass, entityClass.getName(), inverseFieldName,
                  OneToOne.class.getName());
         inverseField.getAnnotation(OneToOne.class).setStringValue("mappedBy", localField.getName());
         java.saveJavaSource(fieldEntityClass);
      }

      if (fetchType != null && fetchType != FetchType.EAGER)
      {
         annotation.setEnumValue("fetch", fetchType);
View Full Code Here

                  fieldName);
         oneAnnotation.setLiteralValue("cascade", "CascadeType.ALL");
         oneAnnotation.getOrigin().addImport(CascadeType.class);

         Refactory.createGetterAndSetter(one, oneField);
         java.saveJavaSource(one);
      }

      if (fetchType != null && fetchType != FetchType.EAGER)
      {
         manyAnnotation.setEnumValue("fetch", fetchType);
View Full Code Here

      {
         // Set the optional attribute of @OneToOne/@ManyToOne only when false, since the default value is true
         manyAnnotation.setLiteralValue("optional", "false");
      }
      addCascade(cascadeTypes, manyAnnotation);
      java.saveJavaSource(many);
   }

   public void newOneToManyRelationship(
            final Project project,
            final JavaResource resource,
View Full Code Here

            many.addImport(one);
         }
         Field<JavaClass> manyField = many.addField("private " + one.getName() + " " + inverseFieldName + ";");
         manyField.addAnnotation(ManyToOne.class);
         Refactory.createGetterAndSetter(many, manyField);
         java.saveJavaSource(many);
      }

      if (fetchType != null && fetchType != FetchType.LAZY)
      {
         annotation.setEnumValue("fetch", fetchType);
View Full Code Here

      if (fetchType != null && fetchType != FetchType.LAZY)
      {
         annotation.setEnumValue("fetch", fetchType);
      }
      addCascade(cascadeTypes, annotation);
      java.saveJavaSource(one);
   }

   public void newManyToManyRelationship(
            final Project project,
            final JavaResource resource,
View Full Code Here

                  + inverseFieldName
                  + "= new HashSet<" + entity.getName() + ">();");
         otherField.addAnnotation(ManyToMany.class);
         Refactory.createGetterAndSetter(otherEntity, otherField);

         java.saveJavaSource(otherEntity);
      }

      if (fetchType != null && fetchType != FetchType.LAZY)
      {
         annotation.setEnumValue("fetch", fetchType);
View Full Code Here

      if (fetchType != null && fetchType != FetchType.LAZY)
      {
         annotation.setEnumValue("fetch", fetchType);
      }
      addCascade(cascadeTypes, annotation);
      java.saveJavaSource(entity);
   }

   private void updateToString(final JavaClass targetEntity)
   {
      if (targetEntity.hasMethodSignature("toString"))
View Full Code Here

         JavaResource javaResource = context.getUIContext().getSelection();
         JavaClassSource command = javaResource.getJavaType();
         JavaClassSource javaClass = createCommand(command, commandName.getValue(), categories.getValue());
         Project project = getSelectedProject(context);
         final JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
         javaResource = java.saveJavaSource(javaClass);
         context.getUIContext().setSelection(javaResource);
      }
      return result;
   }
View Full Code Here

      facetFactory.install(project, DefaultFurnaceContainerFacet.class);
      facetFactory.install(project, CDIFacet_1_1.class);
      facetFactory.install(project, AddonTestFacet.class);

      JavaSourceFacet javaSource = project.getFacet(JavaSourceFacet.class);
      javaSource.saveJavaSource(Roaster.create(JavaPackageInfoSource.class).setPackage(javaSource.getBasePackage()));

      installSelectedAddons(project, dependencyAddons, false);
   }

   /**
 
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.