Example #1
0
  public void addBeanField(String name, TClassType type) {
    classType.getFields().add(new TField(classType, name, type, Modifier.PRIVATE | Modifier.FINAL));

    TMethod getterMethod =
        new TMethod(classType, RenderUtil.getGetterName(type, name), type, Modifier.PUBLIC);
    getterMethod.setMethodContents("return this." + name + ";\n");
    classType.getMethods().add(getterMethod);

    TMethod setterMethod =
        new TMethod(classType, RenderUtil.getSetterName(name), type, Modifier.PUBLIC);
    setterMethod.addParameter(name, type, Modifier.FINAL);
    setterMethod.setMethodContents("this." + name + " = " + name + ";\n");
    classType.getMethods().add(setterMethod);
  }
Example #2
0
 public String render() {
   return classType.render();
 }
Example #3
0
 public void addBeanField(String name, String type) {
   addBeanField(name, TClassType.getClass(type));
 }
Example #4
0
 public void addBeanField(String name, Class<?> type) {
   addBeanField(name, TClassType.getClass(type.getName()));
 }
Example #5
0
 public List<TClassType> getInterface() {
   return classType.getInterfaces();
 }
Example #6
0
 public List<TConstructor> getConstructors() {
   return classType.getConstructors();
 }
Example #7
0
 public List<TField> getFields() {
   return classType.getFields();
 }
Example #8
0
 public BeanModel(String beanName) {
   this.classType = TClassType.getClass(beanName);
   this.classType.setModifiers(Modifier.PUBLIC);
 }