/** * Creates a method with a body for the getter. * * @return getter body */ private String createGetterBody() { // TODO: use access modifier given by user int modifier = this.getGetterVisibility(); if (field.isStatic()) { modifier |= BinModifier.STATIC; } BinMethod getter = new BinMethod( getterName, BinParameter.NO_PARAMS, getField().getTypeRef(), modifier, BinMethod.Throws.NO_THROWS); getter.setOwner(field.getOwner()); BinMethodFormatter formatter = (BinMethodFormatter) getter.getFormatter(); String result = FormatSettings.LINEBREAK + formatter.formHeader(); // TODO migrate to formatting engine also? int baseIndent = new BinTypeFormatter(field.getOwner().getBinCIType()).getMemberIndent(); result += FormatSettings.getIndentString(baseIndent + FormatSettings.getBlockIndent()); result += "return "; if (field.isStatic()) { result += hostingClass.getName(); } else { result += "this"; } result += "." + getField().getName() + ";"; result += FormatSettings.LINEBREAK; result += formatter.formFooter(); return result; }