else
if (methodName.startsWith("get")) methodName = methodName.substring(3);
else
if (methodName.startsWith("is")) methodName = methodName.substring(2);
FormElement element = method.getAnnotation(FormElement.class);
FormSchemas form = method.getAnnotation(FormSchemas.class);
if (form != null) {
for (FormElement e : form.value()) {
if (schema.equals(e.schema())) {
element = e;
break;
}
}
}
if (element != null) {
if (element.type() == TYPE.INCLUDE) {
String aspectName = null;
if (!MString.isEmpty(element.aspect()))
aspectName = prefix + element.aspect() + ".";
else
aspectName = prefix + methodName + ".";
MForm innerTarget = (MForm) method.invoke(target);
if (innerTarget != null) {
ObjectList nextList = list;
if (!MString.isEmpty(element.group())) {
nextList = findGroupList(element, list);
aspectName = "";
}
parseElements(aspectName, innerTarget, nextList);
}
} else
if (element.type() == TYPE.GROUP) {
FGroup next = new FGroup();
list.add(next);
next.initialize(this);
String aspectName = null;
if (!MString.isEmpty(element.aspect()))
aspectName = prefix + element.aspect() + ".";
else
aspectName = prefix + methodName + ".";
next.setTargetFinder(new TargetFinderWithMethod(method));
// next.setParent();
MForm innerTarget = next.getTarget();
if (innerTarget != null) {
ObjectList nextList = next.getList();
parseElements(aspectName, innerTarget, nextList);
}
} else {
FormSortId idx = method.getAnnotation(FormSortId.class);
IConfig xmlElement = fillElement(prefix,method, toXmlString(element,methodName));
ObjectList nextList = list;
if (!MString.isEmpty(element.group())) {
nextList = findGroupList(element, list);
}
FObject next = createModelObjectFromXml(xmlElement,target, nextList);
if (next != null && element.sort() >= 0)
next.setSortId(element.sort());
else
if (next != null && idx != null)
next.setSortId(idx.value());
}
}