public <T>DbSchemaChanger addBeanProperty(String propertyName,Class<T> propertyClazz,String columnName) throws Exception {
  CtField f=new CtField(pool.get(propertyClazz.getName()),propertyName,cc);
  cc.addField(f);
  String getterMethodName=generateGetterMethodName(propertyName);
  StringBuilder method=new StringBuilder("public ");
  method.append(propertyClazz.getName());
  method.append(" ");
  method.append(getterMethodName);
  method.append("() {\n    return ");
  method.append(propertyName);
  method.append(";\n    }");
  log.info("Generate getter method = {}",method.toString());
  CtMethod getter=CtNewMethod.make(method.toString(),cc);
  cc.addMethod(getter);
  String setterMethodName=generateSetterMethodName(propertyName);
  method=new StringBuilder("public void ");
  method.append(setterMethodName);
  method.append("(");
  method.append(propertyClazz.getName());
  method.append(" ");
  method.append(propertyName);
  method.append(") {\n    this.");
  method.append(propertyName);
  method.append(" = ");
  method.append(propertyName);
  method.append(";\n    setChanged(\"");
  method.append(columnName);
  method.append("\");\n    }");
  log.info("Generate setter method = {}",method.toString());
  CtMethod setter=CtNewMethod.make(method.toString(),cc);
  cc.addMethod(setter);
  dumpClassInfo();
  return this;
}

public < T > DbSchemaChanger addBeanProperty ( String propertyName , Class < T > propertyClazz , String columnName ) throws Exception { CtField f = new CtField ( pool . get ( propertyClazz . getName ( ) ) , propertyName , cc ) ; cc . addField ( f ) ; String getterMethodName = generateGetterMethodName ( propertyName ) ; StringBuilder method = new StringBuilder ( "public " ) ; method . append ( propertyClazz . getName ( ) ) ; method . append ( " " ) ; method . append ( getterMethodName ) ; method . append ( "() {\n    return " ) ; method . append ( propertyName ) ; method . append ( ";\n    }" ) ; log . info ( "Generate getter method = {}" , method . toString ( ) ) ; CtMethod getter = CtNewMethod . make ( method . toString ( ) , cc ) ; cc . addMethod ( getter ) ; String setterMethodName = generateSetterMethodName ( propertyName ) ; method = new StringBuilder ( "public void " ) ; method . append ( setterMethodName ) ; method . append ( "(" ) ; method . append ( propertyClazz . getName ( ) ) ; method . append ( " " ) ; method . append ( propertyName ) ; method . append ( ") {\n    this." ) ; method . append ( propertyName ) ; method . append ( " = " ) ; method . append ( propertyName ) ; method . append ( ";\n    setChanged(\"" ) ; method . append ( columnName ) ; method . append ( "\");\n    }" ) ; log . info ( "Generate setter method = {}" , method . toString ( ) ) ; CtMethod setter = CtNewMethod . make ( method . toString ( ) , cc ) ; cc . addMethod ( setter ) ; dumpClassInfo ( ) ; return this ; }
add a bean property to the class i . e . add followings to a class : 1 . a class field 2 . a getter method 3 . a setter method
