@@ -0,0 +1,2171 @@
+package com.tvd12.ezyfox.tool;%0A%0Aimport java.util.List;%0A%0Aimport com.tvd12.ezyfox.reflect.EzyClass;%0Aimport com.tvd12.ezyfox.reflect.EzyClasses;%0Aimport com.tvd12.ezyfox.reflect.EzyField;%0A%0Apublic class EzyCreateSameObjectScriptGenerator %7B%0A%0A%09protected Class%3C?%3E originClass;%0A%09protected Class%3C?%3E targetClass;%0A%09protected String originObjectName;%0A%09protected String targetObjectName;%0A%09protected boolean includeAllFields;%0A%09%0A%09public EzyCreateSameObjectScriptGenerator originClass(Class%3C?%3E originClass) %7B%0A%09%09this.originClass = originClass;%0A%09%09if(originObjectName == null)%0A%09%09%09originObjectName = EzyClasses.getVariableName(originClass);%0A%09%09return this;%0A%09%7D%0A%09%0A%09public EzyCreateSameObjectScriptGenerator targetClass(Class%3C?%3E targetClass) %7B%0A%09%09this.targetClass = targetClass;%0A%09%09if(targetObjectName == null)%0A%09%09%09targetObjectName = EzyClasses.getVariableName(targetClass);%0A%09%09return this;%0A%09%7D%0A%09%0A%09public EzyCreateSameObjectScriptGenerator originObjectName(String originObjectName) %7B%0A%09%09this.originObjectName = originObjectName;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public EzyCreateSameObjectScriptGenerator targetObjectName(String targetObjectName) %7B%0A%09%09this.targetObjectName = targetObjectName;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public EzyCreateSameObjectScriptGenerator includeAllFields(boolean includeAllFields) %7B%0A%09%09this.includeAllFields = includeAllFields;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public String generateScript() %7B%0A%09%09EzyClass originClazz = new EzyClass(originClass);%0A%09%09List%3CEzyField%3E originFields = includeAllFields%0A%09%09%09%09? originClazz.getFields()%0A%09%09%09%09: originClazz.getDeclaredFields();%0A%09%09StringBuilder builder = new StringBuilder();%0A%09%09builder.append(targetClass.getSimpleName())%0A%09%09%09.append(%22 %22)%0A%09%09%09.append(targetObjectName)%0A%09%09%09.append(%22 = %22)%0A%09%09%09.append(%22new %22)%0A%09%09%09.append(targetClass.getSimpleName())%0A%09%09%09.append(%22();%5Cn%22);%0A%09%09int index = 0;%0A%09%09for(EzyField field : originFields) %7B%0A%09%09%09builder.append(targetObjectName)%0A%09%09%09%09.append(%22.%22)%0A%09%09%09%09.append(field.getSetterMethod())%0A%09%09%09%09.append(%22(%22)%0A%09%09%09%09%09.append(originObjectName)%0A%09%09%09%09%09.append(%22.%22)%0A%09%09%09%09%09.append(field.getGetterMethod()).append(%22()%22)%0A%09%09%09%09.append(%22)%22)%0A%09%09%09%09.append(%22;%22);%0A%09%09%09if((index ++) %3C (originFields.size() - 1))%0A%09%09%09%09builder.append(%22%5Cn%22);%0A%09%09%7D%0A%09%09return builder.toString();%0A%09%7D%0A%09%0A%7D%0A

add CreateSameObjectScriptGenerator tool