Examples of JavaSourceFacet


Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

      if (targets.getValue() != null)
      {
         for (JavaClassSource klass : targets.getValue())
         {
            Project project = getSelectedProject(uiContext);
            JavaSourceFacet javaSource = project.getFacet(JavaSourceFacet.class);
            Resource<?> resource = javaSource.getJavaResource(klass);
            if (resource != null)
            {
               resourceCollection.addToCollection(resource);
            }
         }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

   {
      for (JavaClassSource javaSource : targets.getValue())
      {
         UIContext uiContext = context.getUIContext();
         Project project = getSelectedProject(uiContext);
         JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
         if (!javaSource.hasMethodSignature("hashCode"))
         {
            if (generateEqualsAndHashCode.getValue())
            {
               if (javaSource.getField("id") != null)
               {
                  Refactory.createHashCode(javaSource, javaSource.getField("id"));
               }
               else
               {
                  Refactory.createHashCode(javaSource, (FieldSource<?>[]) javaSource.getFields().toArray(new FieldSource[javaSource.getFields().size()]));
               }
             
            }
         }
        
         if(!javaSource.hasMethodSignature("equals", Object.class)) {
            if (generateEqualsAndHashCode.getValue())
            {
               if (javaSource.getField("id") != null)
               {
                  Refactory.createEquals(javaSource, javaSource.getField("id"));
               }
               else
               {
                  Refactory.createEquals(javaSource, (FieldSource<?>[]) javaSource.getFields().toArray(new FieldSource[javaSource.getFields().size()]));
               }
            }
         }
         javaSourceFacet.saveJavaSource(javaSource);
        
        
      }

      return null;
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

      PropertySource<JavaClassSource> property = klass.getProperty(propertyName);
      final Annotation<JavaClassSource> constraintAnnotation = addConstraintOnProperty(property, onAccessor,
               NotNull.class,
               message);

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
   }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

      final AnnotationSource<JavaClassSource> constraintAnnotation = addConstraintOnProperty(property, onAccessor,
               Min.class,
               message);
      constraintAnnotation.setLiteralValue(min);

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
   }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

      final AnnotationSource<JavaClassSource> constraintAnnotation = addConstraintOnProperty(property, onAccessor,
               Max.class,
               message);
      constraintAnnotation.setLiteralValue(max);

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
   }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

      if (max != null)
      {
         constraintAnnotation.setLiteralValue("max", max);
      }

      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
      javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin());
   }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

            }
         }
      }
      else if (project.hasFacet(JavaSourceFacet.class))
      {
         JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
         targetLocation.setDefaultValue(facet.getSourceDirectory()).setEnabled(false);
         targetPackage.setValue(calculateModelPackage(project));
      }
      builder.add(targetLocation);
      builder.add(targetPackage).add(named).add(idStrategy).add(tableName);
   }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

      // assertThat(inspectionResult, hasItemWithEntry("inverse-relationship", inverseFieldName));
   }

   private JavaClassSource getJavaClassFor(String entityName) throws FileNotFoundException
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      return (JavaClassSource) java.getJavaResource(java.getBasePackage() + ".model." + entityName).getJavaType();
   }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

      return (JavaClassSource) java.getJavaResource(java.getBasePackage() + ".model." + entityName).getJavaType();
   }

   private String getJavaClassNameFor(String entityName) throws FileNotFoundException
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      return java.getBasePackage() + ".model." + entityName;
   }
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.facets.JavaSourceFacet

   }

   private void generateOneToOneField(String fieldName, String type, String inverseFieldName, FetchType fetchType,
            boolean required, Iterable<CascadeType> cascadeTypes) throws Exception
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      JavaResource entityClassResource = java.getJavaResource(entityClass);
      projectHelper.createOneToOneField(project, entityClassResource, fieldName, type, inverseFieldName, fetchType,
               required, cascadeTypes);
      entityClass = getJavaClassFor(entityClass.getName());
   }
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.