cn.schoolwow.quickdao.module.operation.flow.generateEntity.single.GenerateGetSetMethodFlow Maven / Gradle / Ivy
package cn.schoolwow.quickdao.module.operation.flow.generateEntity.single;
import cn.schoolwow.quickdao.domain.entity.Entity;
import cn.schoolwow.quickdao.domain.entity.Property;
import cn.schoolwow.quickdao.util.StringUtil;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
public class GenerateGetSetMethodFlow implements BusinessFlow {
@Override
public void executeBusinessFlow(FlowContext flowContext) throws Exception {
Entity databaseEntity = (Entity) flowContext.checkData("databaseEntity");
StringBuilder builder = (StringBuilder) flowContext.checkData("builder");
for(Property property:databaseEntity.properties){
builder.append("\tpublic "+ property.className +" get" + StringUtil.firstLetterUpper(property.name)+"(){\n\t\treturn this."+property.name+";\n\t}\n\n");
builder.append("\tpublic void set" +StringUtil.firstLetterUpper(property.name)+"("+property.className+" "+property.name+"){\n\t\tthis."+property.name+" = "+property.name+";\n\t}\n\n");
}
builder.append("}");
}
@Override
public String name() {
return "生成实体类的GetSet方法部分";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy