-
Notifications
You must be signed in to change notification settings - Fork 51
/
ExtractedValue.java
46 lines (42 loc) · 1.41 KB
/
ExtractedValue.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Bean Validation API
*
* 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 javax.validation.valueextraction;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.OptionalInt;
/**
* Marks the type parameter of a container type to which a {@link ValueExtractor} is tied.
* <p>
* Must be given exactly once for a value extractor type.
*
* @author Gunnar Morling
* @author Guillaume Smet
*
* @see ValueExtractor
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE_USE)
@Documented
public @interface ExtractedValue {
/**
* Returns the type of the value extracted by the {@link ValueExtractor}. If not set, returns
* {@code void.class}, meaning the type will be automatically inferred from the type argument
* of the parameterized type.
* <p>
* Used to define value extractors for non-generic wrapper types e.g. {@link OptionalInt}.
* <p>
* May not be used when {@code ExtractedValue} is defined on the type parameter of
* a generic wrapper type. A {@code ValueExtractorDefinitionException} will be thrown in
* this case.
*
* @return the type of the value extracted by the value extractor
*/
Class<?> type() default void.class;
}