Debian Codegraph @

resteasy-jaxrs/src/main/java/org/jboss/resteasy/spi/validation/GeneralValidator.java

raw symbols SCIP
1 package org.jboss.resteasy.spi.validation;
2
3 import java.lang.reflect.Method;
4
5 import org.jboss.resteasy.spi.HttpRequest;
6
7 /**
8 *
9 * @author <a href="[email protected]">Ron Sigal</a>
10 * @version $Revision: 1.1 $
11 *
12 * Javadoc adapted from javax.validation.Validator and javax.validation.executable.ExecutableValidator:
13 *
14 * @author Emmanuel Bernard
15 * @author Hardy Ferentschik
16 * @author Gunnar Morling
17 */
18 public interface GeneralValidator
19 {
20 /**
21 * Validates all constraints on {@code object}.
22 *
23 * @param object object to validate
24 * @param groups the group or list of groups targeted for validation (defaults to
25 * {@link Default})
26 * @return constraint violations or an empty set if none
27 * @throws IllegalArgumentException if object is {@code null}
28 * or if {@code null} is passed to the varargs groups
29 * @throws ValidationException if a non recoverable error happens
30 * during the validation process
31 */
32 public abstract void validate(HttpRequest request, Object object, Class<?>... groups);
33 /**
34 * Validates all constraints placed on the parameters of the given method.
35 *
36 * @param <T> the type hosting the method to validate
37 * @param object the object on which the method to validate is invoked
38 * @param method the method for which the parameter constraints is validated
39 * @param parameterValues the values provided by the caller for the given method's
40 * parameters
41 * @param groups the group or list of groups targeted for validation (defaults to
42 * {@link Default})
43 * @return a set with the constraint violations caused by this validation;
44 * will be empty if no error occurs, but never {@code null}
45 * @throws IllegalArgumentException if {@code null} is passed for any of the parameters
46 * or if parameters don't match with each other
47 * @throws ValidationException if a non recoverable error happens during the
48 * validation process
49 */
50 public abstract void validateAllParameters(HttpRequest request, Object object, Method method, Object[] parameterValues, Class<?>... groups);
51
52 /**
53 * Validates all return value constraints of the given method.
54 *
55 * @param <T> the type hosting the method to validate
56 * @param object the object on which the method to validate is invoked
57 * @param method the method for which the return value constraints is validated
58 * @param returnValue the value returned by the given method
59 * @param groups the group or list of groups targeted for validation (defaults to
60 * {@link Default})
61 * @return a set with the constraint violations caused by this validation;
62 * will be empty if no error occurs, but never {@code null}
63 * @throws IllegalArgumentException if {@code null} is passed for any of the object,
64 * method or groups parameters or if parameters don't match with each other
65 * @throws ValidationException if a non recoverable error happens during the
66 * validation process
67 */
68 public abstract void validateReturnValue(
69 HttpRequest request, Object object, Method method, Object returnValue, Class<?>... groups);
70
71 /**
72 * Indicates if validation is turned on for a class.
73 *
74 * @param clazz Class to be examined
75 * @return true if and only if validation is turned on for clazz
76 */
77 public abstract boolean isValidatable(Class<?> clazz);
78
79 /**
80 * Indicates if validation is turned on for a method.
81 *
82 * @param method method to be examined
83 * @return true if and only if validation is turned on for method
84 */
85 public abstract boolean isMethodValidatable(Method method);
86
87 /**
88 * Throws a ResteasyViolationException if any validation violations have been detected.
89 *
90 * @param request
91 */
92 public void checkViolations(HttpRequest request);
93 }