Example usage for org.apache.commons.validator FormSet getForms

List of usage examples for org.apache.commons.validator FormSet getForms

Introduction

In this page you can find the example usage for org.apache.commons.validator FormSet getForms.

Prototype

public Map<String, Form> getForms() 

Source Link

Document

A Map of Forms is returned as an unmodifiable Map with the key based on the form name.

Usage

From source file:org.seasar.struts.lessconfig.autoregister.impl.StrutsConfigRegisterImpl.java

private void registerValidations(ModuleConfig config) {
    // Create Forms.
    ValidatorResources currentResources = getValidatorResources(config);
    FormSet formSet = new FormSet();

    FormBeanConfig[] formConfigs = config.findFormBeanConfigs();
    for (int i = 0; i < formConfigs.length; i++) {
        if (!registeredValidation(currentResources, formConfigs[i])) {
            Class clazz = ClassUtil.forName(formConfigs[i].getType());
            String name = formConfigs[i].getName();
            Form form = this.validationCreator.createForm(config, clazz, name);
            if (form != null) {
                formSet.addForm(form);//www . j ava2  s. c  o  m

                if (log.isDebugEnabled()) {
                    log.debug("auto register " + form);
                }
            }
        }
    }

    // Initialize ValidatorResources
    if (formSet.getForms().size() != 0) {
        ValidatorResources resources = new ValidatorResources();
        resources.addFormSet(formSet);
        resources.process();
        addValidatorResources(config, resources);
    }
}