Search in sources :

Example 1 with ExecutableValidationType

use of org.apache.openejb.jee.bval.ExecutableValidationType in project tomee by apache.

the class ValidatorBuilder method getInfo.

public static ValidationInfo getInfo(final ValidationConfigType config) {
    final ValidationInfo info = new ValidationInfo();
    if (config != null) {
        info.version = config.getVersion();
        info.providerClassName = config.getDefaultProvider();
        info.constraintFactoryClass = config.getConstraintValidatorFactory();
        info.traversableResolverClass = config.getTraversableResolver();
        info.messageInterpolatorClass = config.getMessageInterpolator();
        info.parameterNameProviderClass = config.getParameterNameProvider();
        final ExecutableValidationType executableValidation = config.getExecutableValidation();
        if (executableValidation != null) {
            info.executableValidationEnabled = executableValidation.getEnabled();
            final DefaultValidatedExecutableTypesType executableTypes = executableValidation.getDefaultValidatedExecutableTypes();
            if (executableTypes != null) {
                for (final ExecutableType type : executableTypes.getExecutableType()) {
                    info.validatedTypes.add(type.name());
                }
            }
        }
        for (final PropertyType p : config.getProperty()) {
            info.propertyTypes.put(p.getName(), p.getValue());
        }
        for (final String element : config.getConstraintMapping()) {
            info.constraintMappings.add(element);
        }
    }
    return info;
}
Also used : ExecutableType(javax.validation.executable.ExecutableType) DefaultValidatedExecutableTypesType(org.apache.openejb.jee.bval.DefaultValidatedExecutableTypesType) PropertyType(org.apache.openejb.jee.bval.PropertyType) ExecutableValidationType(org.apache.openejb.jee.bval.ExecutableValidationType)

Aggregations

ExecutableType (javax.validation.executable.ExecutableType)1 DefaultValidatedExecutableTypesType (org.apache.openejb.jee.bval.DefaultValidatedExecutableTypesType)1 ExecutableValidationType (org.apache.openejb.jee.bval.ExecutableValidationType)1 PropertyType (org.apache.openejb.jee.bval.PropertyType)1