* @param fieldInfo the collectionInfo to translate
* @param jClass the jClass to add the method to.
*/
protected void createRemoveByIndexMethod(final CollectionInfo fieldInfo,
final JClass jClass) {
JMethod method = new JMethod("remove" + fieldInfo.getMethodSuffix() + "At",
fieldInfo.getContentType().getJType(),
"the element removed from the collection");
method.addParameter(new JParameter(JType.INT, "index"));
JSourceCode sourceCode = method.getSourceCode();
sourceCode.add("java.lang.Object obj = this.");
sourceCode.append(fieldInfo.getName());
sourceCode.append(".remove(index);");
if (fieldInfo.isBound()) {
this.createBoundPropertyCode(fieldInfo, sourceCode);
}
sourceCode.add("return ");
if (fieldInfo.getContentType().getType() == XSType.CLASS) {
sourceCode.append("(");
sourceCode.append(method.getReturnType().getName());
sourceCode.append(") obj;");
} else {
sourceCode.append(fieldInfo.getContentType().createFromJavaObjectCode("obj"));
sourceCode.append(";");
}