* @param useJava50 java version flag
*/
private void createSetAsArrayMethod(final CollectionInfo fieldInfo,
final JClass jClass, final boolean useJava50) {
JMethod method = new JMethod("set" + fieldInfo.getMethodSuffix());
final JParameter parameter = new JParameter(new JArrayType(
fieldInfo.getContentType().getJType(), useJava50),
fieldInfo.getContentName() + "Array");
method.addParameter(parameter);
JSourceCode sourceCode = method.getSourceCode();
String index = "i";
if (parameter.getName().equals(index)) {
index = "j";
}
sourceCode.add("//-- copy array");
sourceCode.add(fieldInfo.getName());
sourceCode.append(".clear();");
sourceCode.add("");
sourceCode.add("for (int ");
sourceCode.append(index);
sourceCode.append(" = 0; ");
sourceCode.append(index);
sourceCode.append(" < ");
sourceCode.append(parameter.getName());
sourceCode.append(".length; ");
sourceCode.append(index);
sourceCode.append("++) {");
sourceCode.indent();
sourceCode.addIndented("this.");
sourceCode.append(fieldInfo.getName());
sourceCode.append(".add(");
sourceCode.append(fieldInfo.getContentType().createToJavaObjectCode(
parameter.getName() + "[" + index + "]"));
sourceCode.append(");");
sourceCode.unindent();
sourceCode.add("}");
if (fieldInfo.isBound()) {