001    // Copyright 2006-2007 Daniel Gredler
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package net.sf.beanform.validator;
016    
017    import java.util.List;
018    
019    import net.sf.beanform.prop.BeanProperty;
020    import net.sf.beanform.util.ReflectionUtils;
021    
022    import org.apache.tapestry.IComponent;
023    import org.apache.tapestry.event.ReportStatusListener;
024    import org.apache.tapestry.event.ResetEventListener;
025    import org.apache.tapestry.form.validator.Validator;
026    import org.apache.tapestry.form.validator.ValidatorFactory;
027    
028    /**
029     * Wraps a {@link ValidatorFactory} to provide caching services for the generated validator lists.
030     * This isn't normally necessary, as the validator bindings are cached along with the pages, but
031     * we're not using validator bindings because we need the validation lists to be built dynamically.
032     * It also adds "inherent" validators to the generated lists -- these are validators that are inherent
033     * to the property type.
034     *
035     * @see AbstractNumberValidator
036     * @see ReflectionUtils#convertToType(Object, Class)
037     *
038     * @author Daniel Gredler
039     */
040    public interface CachingValidatorFactory extends ResetEventListener, ReportStatusListener {
041    
042        public List<Validator> constructValidatorList( IComponent component, BeanProperty property );
043    
044    }