01: package org.strecks.form.controller;
02:
03: import org.apache.struts.action.ActionForm;
04: import org.strecks.bind.internal.BindAnnotationReader;
05: import org.strecks.bind.internal.BindConvertInfo;
06: import org.strecks.validator.internal.ValidationAnnotationReader;
07: import org.strecks.validator.internal.ValidationInfo;
08:
09: /**
10: * @author Phil Zoio
11: */
12: public class FormTestUtils {
13:
14: public static DelegatingForm getDelegatingForm(ActionForm form) {
15: BindAnnotationReader bindReader = new BindAnnotationReader();
16: BindConvertInfo bindConvertInfo = bindReader
17: .readBindables(form);
18:
19: DelegatingForm delegator = new DelegatingForm(form);
20: delegator.setBindConvertInfo(bindConvertInfo);
21:
22: ValidationAnnotationReader reader = new ValidationAnnotationReader();
23: ValidationInfo validatorMap = reader.readValidationHandlers(
24: form, bindConvertInfo);
25: delegator.setValidationInfo(validatorMap);
26:
27: return delegator;
28: }
29:
30: }
|