Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HV-1261 Loading value extractors via service loader
- Loading branch information
1 parent
c6f85f3
commit 4a04518
Showing
5 changed files
with
87 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...va/org/hibernate/validator/test/internal/engine/cascaded/GuavaOptionalValueExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Hibernate Validator, declare and validate application constraints | ||
* | ||
* License: Apache License, Version 2.0 | ||
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
*/ | ||
package org.hibernate.validator.test.internal.engine.cascaded; | ||
|
||
import javax.validation.valueextraction.ExtractedValue; | ||
import javax.validation.valueextraction.ValueExtractor; | ||
|
||
import com.google.common.base.Optional; | ||
|
||
/** | ||
* @author Gunnar Morling | ||
*/ | ||
public class GuavaOptionalValueExtractor implements ValueExtractor<Optional<@ExtractedValue ?>> { | ||
|
||
@Override | ||
public void extractValues(Optional<@ExtractedValue ?> originalValue, ValueExtractor.ValueReceiver receiver) { | ||
receiver.value( null, originalValue.isPresent() ? originalValue.get() : null ); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
engine/src/test/resources/META-INF/services/javax.validation.valueextraction.ValueExtractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.hibernate.validator.test.internal.engine.cascaded.GuavaOptionalValueExtractor |