Class GeneralValidatorImpl

    • Constructor Detail

      • GeneralValidatorImpl

        public GeneralValidatorImpl​(javax.validation.ValidatorFactory validatorFactory,
                                    boolean isExecutableValidationEnabled,
                                    Set<javax.validation.executable.ExecutableType> defaultValidatedExecutableTypes)
    • Method Detail

      • validate

        public void validate​(HttpRequest request,
                             Object object,
                             Class<?>... groups)
        Description copied from interface: GeneralValidator
        Validates all constraints on object.
        Specified by:
        validate in interface GeneralValidator
        Parameters:
        request - http request
        object - object to validate
        groups - the group or list of groups targeted for validation (defaults to Default)
      • checkViolations

        public void checkViolations​(HttpRequest request)
        Description copied from interface: GeneralValidator
        Throws a ResteasyViolationException if any validation violations have been detected.
        Specified by:
        checkViolations in interface GeneralValidator
        Parameters:
        request - http request
      • checkViolationsfromCDI

        public void checkViolationsfromCDI​(HttpRequest request)
        Description copied from interface: GeneralValidatorCDI
        Throws a ResteasyViolationException if any validation violations have been detected. The method should be called only from the resteasy-cdi module.
        Specified by:
        checkViolationsfromCDI in interface GeneralValidatorCDI
        Parameters:
        request - http request
      • validateAllParameters

        public void validateAllParameters​(HttpRequest request,
                                          Object object,
                                          Method method,
                                          Object[] parameterValues,
                                          Class<?>... groups)
        Description copied from interface: GeneralValidator
        Validates all constraints placed on the parameters of the given method.
        Specified by:
        validateAllParameters in interface GeneralValidator
        Parameters:
        request - http request
        object - the object on which the method to validate is invoked
        method - the method for which the parameter constraints is validated
        parameterValues - the values provided by the caller for the given method's parameters
        groups - the group or list of groups targeted for validation (defaults to Default)
      • validateReturnValue

        public void validateReturnValue​(HttpRequest request,
                                        Object object,
                                        Method method,
                                        Object returnValue,
                                        Class<?>... groups)
        Description copied from interface: GeneralValidator
        Validates all return value constraints of the given method.
        Specified by:
        validateReturnValue in interface GeneralValidator
        Parameters:
        request - http request
        object - the object on which the method to validate is invoked
        method - the method for which the return value constraints is validated
        returnValue - the value returned by the given method
        groups - the group or list of groups targeted for validation (defaults to Default)
      • isValidatable

        public boolean isValidatable​(Class<?> clazz)
        Description copied from interface: GeneralValidator
        Indicates if validation is turned on for a class.
        Specified by:
        isValidatable in interface GeneralValidator
        Parameters:
        clazz - Class to be examined
        Returns:
        true if and only if validation is turned on for clazz
      • isValidatable

        public boolean isValidatable​(Class<?> clazz,
                                     InjectorFactory injectorFactory)
        Description copied from interface: GeneralValidatorCDI
        Indicates if validation is turned on for a class. This method should be called from the resteasy-jaxrs module. It should test if injectorFactor is an instance of CdiInjectorFactory, which indicates that CDI is active. If so, it should return false. Otherwise, it should return the same value returned by GeneralValidator.isValidatable().
        Specified by:
        isValidatable in interface GeneralValidatorCDI
        Parameters:
        clazz - Class to be examined
        injectorFactory - the InjectorFactory used for clazz
        Returns:
        true if and only if validation is turned on for clazz
      • isValidatableFromCDI

        public boolean isValidatableFromCDI​(Class<?> clazz)
        Description copied from interface: GeneralValidatorCDI
        Indicates if validation is turned on for a class. This method should be called only from the resteasy-cdi module.
        Specified by:
        isValidatableFromCDI in interface GeneralValidatorCDI
        Parameters:
        clazz - Class to be examined
        Returns:
        true if and only if validation is turned on for clazz
      • isMethodValidatable

        public boolean isMethodValidatable​(Method m)
        Description copied from interface: GeneralValidator
        Indicates if validation is turned on for a method.
        Specified by:
        isMethodValidatable in interface GeneralValidator
        Parameters:
        m - method to be examined
        Returns:
        true if and only if validation is turned on for method
      • getExecutableTypesOnMethodInHierarchy

        protected List<javax.validation.executable.ExecutableType[]> getExecutableTypesOnMethodInHierarchy​(Method method)
      • getExecutableTypesOnMethodInInterfaces

        protected List<javax.validation.executable.ExecutableType[]> getExecutableTypesOnMethodInInterfaces​(Class<?> clazz,
                                                                                                            Method method)
      • getExecutableTypesOnMethod

        protected static javax.validation.executable.ExecutableType[] getExecutableTypesOnMethod​(Method method)
      • isGetter

        protected static boolean isGetter​(Method m)
      • convertArrayToString

        protected static String convertArrayToString​(Object o)
      • getSuperMethod

        protected Method getSuperMethod​(Method method,
                                        Class<?> clazz)
        Returns a super method, if any, of a method in a class. Here, the "super" relationship is reflexive. That is, a method is a super method of itself.
      • overrides

        protected boolean overrides​(Method subTypeMethod,
                                    Method superTypeMethod)
        Checks, whether subTypeMethod overrides superTypeMethod. N.B. "Override" here is reflexive. I.e., a method overrides itself.
        Parameters:
        subTypeMethod - The sub type method (cannot be null).
        superTypeMethod - The super type method (cannot be null).
        Returns:
        Returns true if subTypeMethod overrides superTypeMethod, false otherwise. Taken from Hibernate Validator
      • parametersResolveToSameTypes

        protected boolean parametersResolveToSameTypes​(Method subTypeMethod,
                                                       Method superTypeMethod)
        Taken from Hibernate Validator
      • checkForConstraintViolations

        public void checkForConstraintViolations​(HttpRequest request,
                                                 Exception e)
        Description copied from interface: GeneralValidatorCDI
        Throws a ResteasyViolationException if either a ConstraintViolationException or a ResteasyConstraintViolationException is embedded in the cause hierarchy of e.
        Specified by:
        checkForConstraintViolations in interface GeneralValidatorCDI
        Parameters:
        request - http request
        e - exception
      • getValidator

        protected javax.validation.Validator getValidator​(HttpRequest request)