String fieldName = RebindUtils.toFieldName(beanMethod.getName());
protected void generateSetBeanAttributes(SourceWriter source, JMethod[] methods, String simpleName) { // create the set attribute method source.println("public void setBeanAttribute(String attr, Object value) {"); source.indent(); for (int i = 0; i < methods.length; i++) { if (isExcludedMethod(methods[i])) { // there was a method but was excluded continue; } JMethod methode = methods[i]; if (isSetter(methode)) { JType paramType = methode.getParameters()[0].getType(); source.println("if (attr.equals(\"" + RebindUtils.toFieldName(methode.getName()) + "\")) { "); source.indent(); source.println("this." + methode.getName() + "(" + castFromString(paramType, "value") + ");"); source.outdent(); source.print("} else "); } } source.println("if (attr.equals(\"" + BEAN_WRAPPER_CONTENT + "\")) {"); source.indent(); source.println("this." + BEAN_WRAPPER_CONTENT + " = (" + simpleName + ") value;"); source.outdent(); source.println("} else "); source.print("{"); source.println("}"); source.outdent(); source.println("}"); }
JType returnType = methods[i].getReturnType(); if (isGetter(methods[i])) { source.println("if (attr.equals(\"" + RebindUtils.toFieldName(methodName) + "\")) {"); source.indent(); source.println("return " + castToString(returnType, "this." + methodName + "()") + ";");
protected void generateGetterForBean(SourceWriter source, JMethod methode) { String field = RebindUtils.toFieldName(methode.getName()); JType returnType = methode.getReturnType();
protected void generateSetterForBean(SourceWriter source, JMethod methode, JParameter parameter, JMethod getter) { String field = RebindUtils.toFieldName(methode.getName()) + NESTED_BEAN_WRAPPER; JType returnType = parameter.getType();