resteasy-jaxrs/src/main/java/org/jboss/resteasy/spi/validation/GeneralValidatorCDI.java
raw symbols SCIP| 1 | package org.jboss.resteasy.spi.validation; |
| 2 | |
| 3 | import org.jboss.resteasy.spi.HttpRequest; |
| 4 | import org.jboss.resteasy.spi.InjectorFactory; |
| 5 | |
| 6 | /** |
| 7 | * |
| 8 | * @author <a href="[email protected]">Ron Sigal</a> |
| 9 | * @version $Revision: 1.1 $ |
| 10 | * |
| 11 | * If CDI is enabled, validation will be invoked from an interceptor, |
| 12 | * rather than from ResourceMethodInvoker and MethodInjectorImpl. |
| 13 | * |
| 14 | * Copyright Feb 12, 2014 |
| 15 | */ |
| 16 | public interface GeneralValidatorCDI extends GeneralValidator |
| 17 | { |
| 18 | /** |
| 19 | * Indicates if validation is turned on for a class. |
| 20 | * |
| 21 | * This method should be called from the resteasy-jaxrs module. It should |
| 22 | * test if injectorFactor is an instance of CdiInjectorFactory, which indicates |
| 23 | * that CDI is active. If so, it should return false. Otherwise, it should |
| 24 | * return the same value returned by GeneralValidator.isValidatable(). |
| 25 | * |
| 26 | * @param clazz Class to be examined |
| 27 | * @param injectorFactory the InjectorFactory used for clazz |
| 28 | * @return true if and only if validation is turned on for clazz |
| 29 | */ |
| 30 | public boolean isValidatable(Class<?> clazz, InjectorFactory injectorFactory); |
| 31 | |
| 32 | /** |
| 33 | * Indicates if validation is turned on for a class. |
| 34 | * This method should be called only from the resteasy-cdi module. |
| 35 | * |
| 36 | * @param clazz Class to be examined |
| 37 | * @return true if and only if validation is turned on for clazz |
| 38 | */ |
| 39 | public abstract boolean isValidatableFromCDI(Class<?> clazz); |
| 40 | |
| 41 | /** |
| 42 | * Throws a ResteasyViolationException if any validation violations have been detected. |
| 43 | * The method should be called only from the resteasy-cdi module. |
| 44 | * @param request |
| 45 | */ |
| 46 | public void checkViolationsfromCDI(HttpRequest request); |
| 47 | |
| 48 | /** |
| 49 | * Throws a ResteasyViolationException if either a ConstraintViolationException or a |
| 50 | * ResteasyConstraintViolationException is embedded in the cause hierarchy of e. |
| 51 | * |
| 52 | * @param request |
| 53 | * @param e |
| 54 | */ |
| 55 | public void checkForConstraintViolations(HttpRequest request, Exception e); |
| 56 | } |