private MethodDeclaration setterDeclaration(EntityField field) {
MethodDeclaration decl = new MethodDeclaration(ModifierSet.PUBLIC,
new VoidType(),
"set" + CaseConverter.pascalCase(field.getName()),
Collections.singletonList(new Parameter(
ASTHelper.createReferenceType(field.getType().getSimpleName(), 0),
new VariableDeclaratorId(field.getName()))));
BlockStmt body = new BlockStmt();
body.setStmts(
Collections.singletonList(
new ExpressionStmt(
new AssignExpr(
new FieldAccessExpr(new ThisExpr(), field.getName()),
ASTHelper.createNameExpr(field.getName()),
AssignExpr.Operator.assign
))));
decl.setBody(body);
return decl;
}