# Bypass getter validation for seemingly getters

**URL:** <https://discourse.hibernate.org/t/bypass-getter-validation-for-seemingly-getters/2816>\
**Category:** Hibernate Validator\
**Created:** [June 6, 2019, 11:47am UTC](https://discourse.hibernate.org/t/bypass-getter-validation-for-seemingly-getters/2816 "2019-06-06T11:47:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![UKreher](https://avatars.discourse-cdn.com/v4/letter/u/858c86/32.png) [@UKreher](https://discourse.hibernate.org/u/UKreher)\
**Post date:** [June 6, 2019, 11:47am UTC](https://discourse.hibernate.org/t/bypass-getter-validation-for-seemingly-getters/2816/1 "2019-06-06T11:47:00Z")

</div>

Hi all,

we are using Jersey 2.28 with Hibernate Validator 6.0.15. We have classes (REST resources) providing data via methods called “get\*”. Some of these methods do not have any explicit parameters but retrieve them indirectly from the HTTP header. So they just seem like bean properties but are not.

Jersey processes a REST call as follows:

1. Validating input parameters via Hibernate Validator.
2. Calling the method.
3. Validating the result via Hibernate Validator.

If some header data is missing for a seemingly getter, it will throw an appropriate exception. If this happens in step 2, everything is fine. But since Hibernate Validator treats the getter as bean property (`ConstrainedExecutable.isGetterMethod()` is `true`), it validates the result in step 1. Therefore validation fails with a validation exception wrapping/swallowing the actual exception for missing header data.

Is it possible to disable the behaviour to treat all “get\*” methods without parameters as bean property in Hibernate Validator? I do not want to rename these methods. They return data, so “getData” is an appropriate name.

I tried to implement a bypass for Hibernate Validator but failed due to classes (e. g. `MethodConstraintMappingContextImpl`) and methods (e. g. `BeanMetaDataManager.createBeanMetaData(Class)`) not being extensible and wrapping being prevented by using implementations instead of interfaces (e. g. `ConfigurationImpl.addMapping(ConstraintMapping)`).
