Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 // Copyright 2007, 2008 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
 //     http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.tapestry5.internal.services;
import static org.apache.tapestry5.ioc.internal.util.CollectionFactory.newList;
            ValidationConstraintGenerator validationConstraintGenerator,
            FieldValidatorSource fieldValidatorSource)
    {
        this. = validationConstraintGenerator;
        this. = fieldValidatorSource;
    }
    public FieldValidator createDefaultValidator(Field fieldString overrideId,
                                                 Messages overrideMessagesLocale localeClass propertyType,
                                                 AnnotationProvider propertyAnnotations)
    {
        List<FieldValidatorvalidators = newList();
        for (String constraint : .buildConstraints(
                propertyType,
                propertyAnnotations))
        {
            int equalsx = constraint.indexOf('=');
            String validatorType = equalsx > 0 ? constraint.substring(0, equalsx) : constraint;
            String constraintValue = equalsx > 0 ? constraint.substring(equalsx + 1) : null;
            FieldValidator validator = .createValidator(
                    field,
                    validatorType,
                    constraintValue,
                    overrideId,
                    overrideMessages,
                    locale);
            validators.add(validator);
        }
        return validators.size() == 1 ? validators.get(0) : new CompositeFieldValidator(validators);
    }
    public FieldValidator createDefaultValidator(ComponentResources resourcesString parameterName)
    {
        Class propertyType = resources.getBoundType(parameterName);
        if (propertyType == nullreturn null;
        Field field = (Fieldresources.getComponent();
        return createDefaultValidator(fieldresources.getId(), resources.getContainerMessages(), resources.getLocale(),
                                      propertyTyperesources.getAnnotationProvider(parameterName));
    }
New to GrepCode? Check out our FAQ X