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); }
public String render() { return classType.render(); }
public void addBeanField(String name, String type) { addBeanField(name, TClassType.getClass(type)); }
public void addBeanField(String name, Class<?> type) { addBeanField(name, TClassType.getClass(type.getName())); }
public List<TClassType> getInterface() { return classType.getInterfaces(); }
public List<TConstructor> getConstructors() { return classType.getConstructors(); }
public List<TField> getFields() { return classType.getFields(); }
public BeanModel(String beanName) { this.classType = TClassType.getClass(beanName); this.classType.setModifiers(Modifier.PUBLIC); }