// all fields carrying @struts:form-field form-name="<bla>" where <bla> is current
// form name, or all persistent fields if include-all="true" is set
// pk fields are included implicitly, unless include-pk="false" is specified.
Log log = LogUtil.getLog(StrutsFormTagsHandler.class, "forAllFormFields");
XClass currentClass = getCurrentClass();
Map foundFields = new HashMap();
if (log.isDebugEnabled()) {
log.debug("BEGIN-----------------------------------------");
}
do {
pushCurrentClass(currentClass);
if (log.isDebugEnabled()) {
log.debug("-----CLASS=" + getCurrentClass().getName() + "----------------");
}
Collection methods = getCurrentClass().getMethods();
for (Iterator j = methods.iterator(); j.hasNext(); ) {
setCurrentMethod((XMethod)j.next());
// We are interested in persistent fields and fields marked as a form-field.
if (MethodTagsHandler.isGetter(getCurrentMethod().getName()) &&
!foundFields.containsKey(getCurrentMethod().getName()) &&
useMethodInForm(getCurrentMethod())) {
if (useMethodInForm(getCurrentMethod())) {
if (log.isDebugEnabled()) {
log.debug("METHOD(I=" + getCurrentMethod().getName());
}
// Store that we found this field so we don't add it twice
foundFields.put(getCurrentMethod().getName(), getCurrentMethod().getName());
generate(template);
}
}
}
// Add super class info
if (getCurrentClass().getSuperclass().getQualifiedName().equals("java.lang.Object")) {
popCurrentClass();
break;
}
popCurrentClass();
currentClass = currentClass.getSuperclass();
} while (true);
if (log.isDebugEnabled()) {
log.debug("END-------------------------------------------");
}