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

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


      final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor,
               DecimalMin.class, message);
      constraintAnnotation.setStringValue(min);

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
      return outputConstraintAdded(property, DecimalMin.class);
   }

   public Result addDecimalMaxConstraint(Project project, Property property, boolean onAccessor, String message,
            String max) throws FileNotFoundException
View Full Code Here


      final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor,
               DecimalMax.class, message);
      constraintAnnotation.setStringValue(max);

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
      return outputConstraintAdded(property, DecimalMax.class);
   }

   public Result addSizeConstraint(Project project, Property property, boolean onAccessor, String message,
            Integer min, Integer max) throws FileNotFoundException
View Full Code Here

      {
         constraintAnnotation.setLiteralValue("max", String.valueOf(max));
      }

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
      return outputConstraintAdded(property, Size.class);
   }

   public Result addDigitsConstraint(Project project, Property property, boolean onAccessor, String message,
            int integer, int fraction) throws FileNotFoundException
View Full Code Here

               message);
      constraintAnnotation.setLiteralValue("integer", String.valueOf(integer));
      constraintAnnotation.setLiteralValue("fraction", String.valueOf(fraction));

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
      return outputConstraintAdded(property, Digits.class);
   }

   public Result addPastConstraint(Project project, Property property, boolean onAccessor, String message)
            throws FileNotFoundException
View Full Code Here

   {
      final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor, Past.class,
               message);

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
      return outputConstraintAdded(property, Past.class);
   }

   public Result addFutureConstraint(Project project, Property property, boolean onAccessor, String message
            ) throws FileNotFoundException
View Full Code Here

   {
      final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor, Future.class,
               message);

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
      return outputConstraintAdded(property, Future.class);
   }

   public Result addPatternConstraint(Project project, Property property, boolean onAccessor, String message,
            int integer, int fraction, String regexp, Pattern.Flag[] flags) throws FileNotFoundException
View Full Code Here

         flagsLiteral.append('}');
         constraintAnnotation.setStringValue("flags", flagsLiteral.toString());
      }

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
      return outputConstraintAdded(property, Pattern.class);
   }

   private Annotation<JavaClass> addConstraintOnProperty(Property property, boolean onAccessor,
            Class<? extends java.lang.annotation.Annotation> annotationClass, String message)
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

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.