1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.myfaces.extensions.validator.core.interceptor; 20 21 import org.apache.myfaces.extensions.validator.internal.UsageInformation; 22 import org.apache.myfaces.extensions.validator.internal.UsageCategory; 23 import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter; 24 import org.apache.myfaces.extensions.validator.core.InvocationOrderSupport; 25 26 import javax.faces.context.FacesContext; 27 import javax.faces.component.UIComponent; 28 import java.util.Map; 29 30 /** 31 * Property-validation interceptors allow to intercept the validation of a property. It's possible to register a 32 * global interceptor which intercepts the validation process of all properties or a local interceptor 33 * (= a {@link org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter} which allows 34 * to intercept the validation of the constraint which hosts the interceptor as 35 * {@link org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter}. 36 * 37 * @author Gerhard Petracek 38 * @since x.x.3 39 */ 40 @InvocationOrderSupport 41 @UsageInformation(UsageCategory.API) 42 public interface PropertyValidationInterceptor extends ValidationParameter 43 { 44 /** 45 * Executed before the {@link org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy 46 * validation strategies} are invoked to validate the converted value. 47 * 48 * @param facesContext The JSF Context 49 * @param uiComponent The component which is processed 50 * @param convertedObject The converted object 51 * @param properties Additional information of interest. Contains e.g. the 52 * {@link org.apache.myfaces.extensions.validator.core.property.PropertyInformation} extracted from the component. 53 * @return false if the validation process should be bypassed 54 */ 55 boolean beforeValidation(FacesContext facesContext, 56 UIComponent uiComponent, 57 Object convertedObject, 58 Map<String, Object> properties); 59 60 /** 61 * Processed if validation was executed. 62 * In contrast to a {@link org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor 63 * ValidationExceptionInterceptor} it gets executed in any case. 64 * @param facesContext The JSF Context 65 * @param uiComponent The component which is processed 66 * @param convertedObject The converted object 67 * @param properties Additional information of interest. Contains e.g. the 68 * {@link org.apache.myfaces.extensions.validator.core.property.PropertyInformation} extracted from the component. 69 */ 70 void afterValidation(FacesContext facesContext, 71 UIComponent uiComponent, 72 Object convertedObject, 73 Map<String, Object> properties); 74 }