Package org.ajax4jsf.builder.model

Examples of org.ajax4jsf.builder.model.JavaField


  @Override
  public void process(PropertyBean propertyBean, JavaClass javaClass,
      JSFGeneratorConfiguration configuration) {

    JavaField field = getField(propertyBean, configuration);
    JavaMethod accessor = getAccessor(configuration, propertyBean, field);
    JavaMethod mutator = getMutator(configuration, propertyBean, field);
   
    if("action".equals(propertyBean.getName())) {
     
      try {
        accessor.setMethodBody(new VelocityMethodBody(configuration) {
          @Override
          public String getTemplate() {
            return "snippets/get-action.vm";
          }
        });
        mutator.setMethodBody(new VelocityMethodBody(configuration) {
          @Override
          public String getTemplate() {
            return "snippets/set-action.vm";
          }
        });
       
      } catch (GeneratorException e) {
        e.printStackTrace();
      }
     
    } else  {
      javaClass.addField(field);
    }

    if (field.getType().getName().equals(MethodBinding.class.getName())) {
     
      for(JavaLanguageElement el : new JavaLanguageElement[] {field, accessor, mutator}) {
        el.addAnnotation(SuppressWarnings.class, "\"deprecation\"");
      }
     
View Full Code Here


    });
    return method;
  }
 
  private JavaField getComponentType(ComponentBean componentBean) {
    JavaField field = new JavaField(String.class, "COMPONENT_TYPE");
    field.addModifier(JavaModifier.PUBLIC);
    field.addModifier(JavaModifier.STATIC);
    field.addModifier(JavaModifier.FINAL);
    field.setValue("\"" + componentBean.getName() + "\"");
    return field;
  }
View Full Code Here

    field.addModifier(JavaModifier.FINAL);
    field.setValue("\"" + componentBean.getName() + "\"");
    return field;
  }
  private JavaField getComponentFamily(ComponentBean componentBean) {
    JavaField field = new JavaField(String.class, "COMPONENT_FAMILY");
    field.addModifier(JavaModifier.PUBLIC);
    field.addModifier(JavaModifier.STATIC);
    field.addModifier(JavaModifier.FINAL);
    field.setValue("\"" + componentBean.getFamily() + "\"");
    return field;
  }
View Full Code Here

    return propertyBean.isSimpleType() && super.accept(propertyBean, javaClass, configuration);
  }
 
  @Override
  public void process(PropertyBean propertyBean, JavaClass javaClass, JSFGeneratorConfiguration configuration) {
    JavaField field = getField(propertyBean, configuration);
    JavaField field2 = new JavaField(boolean.class, field.getName() + "Set", "false");
    field2.addModifier(JavaModifier.PRIVATE);
    if (propertyBean.isTransient()) {
        field2.addModifier(JavaModifier.TRANSIENT);
    }
    JavaMethod accessor = getAccessor(configuration, propertyBean, field);
    MethodBody accessorMethodBody;
   
    try {
View Full Code Here

  /* (non-Javadoc)
   * @see org.ajax4jsf.builder.render.PropertyProcessor#process(org.ajax4jsf.builder.config.PropertyBean, org.ajax4jsf.builder.model.JavaClass)
   */
  public void process(PropertyBean propertyBean, JavaClass javaClass, JSFGeneratorConfiguration configuration) {
    JavaField field = getField(propertyBean, configuration);

    javaClass.addField(field);
    javaClass.addMethod(getAccessor(configuration, propertyBean, field));
    javaClass.addMethod(getMutator(configuration, propertyBean, field));
  }
View Full Code Here

 
  protected JavaField getField(PropertyBean propertyBean, JSFGeneratorConfiguration configuration) {
    String name = propertyBean.getName();
    String defaultvalue = propertyBean.getDefaultvalue();
    Class<?> propertyClass = getType(propertyBean, configuration.getClassLoader());
    JavaField field = new JavaField(propertyClass, "_" + name, defaultvalue);
    field.getComments().add(new JavaComment(propertyBean.getXmlEncodedDescription()));
    field.getModifiers().add(JavaModifier.PRIVATE);
   
    if (propertyBean.isTransient()) {
        field.addModifier(JavaModifier.TRANSIENT);
    }
   
    handleDeprecation(field.getType(), field);
    return field;
  }
View Full Code Here

  }
 
  public static void main(String[] args) {
    JavaClass javaClass = new JavaClass("MyClass", new JavaPackage("mypackage"));
   
    JavaField javaField = new JavaField(int.class, "count");
    javaField.setValue(0);
    javaField.getModifiers().add(JavaModifier.PRIVATE);
    javaClass.addField(javaField);
   
    JavaField field =
      new JavaField(UIComponentBase.class, "component", "null");
    field.addModifier(JavaModifier.PUBLIC);
    field.addAnnotation(Deprecated.class);
    javaClass.addField(field);
   
    javaClass.addAnnotation(Deprecated.class);
   
    JavaMethod accessor = new JavaMethod("getCount", int.class);
View Full Code Here

TOP

Related Classes of org.ajax4jsf.builder.model.JavaField

Copyright © 2018 www.massapicom. 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.