File tree 4 files changed +66
-5
lines changed
validator/src/main/java/io/avaje/validation/core
validator-generator/src/main/java/io/avaje/validation/generator
4 files changed +66
-5
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,11 @@ int genericTypeParamsCount() {
129
129
130
130
private boolean includeField (Element element ) {
131
131
return !element .getModifiers ().contains (Modifier .TRANSIENT )
132
- && (!element .getAnnotationMirrors ().isEmpty () || element .asType ().toString ().contains ("@" ));
132
+ && (element .getAnnotationMirrors ().stream ()
133
+ //filter lombok's suppress warnings and generated annotations
134
+ .filter (m -> !m .toString ().contains ("@java" ))
135
+ .anyMatch (m -> !m .toString ().contains ("lombok" ))
136
+ || element .asType ().toString ().contains ("@" ));
133
137
}
134
138
135
139
private void readMethod (Element element , TypeElement type , List <FieldReader > localFields ) {
Original file line number Diff line number Diff line change 25
25
26
26
/** Builds and caches the ValidationAdapter adapters for DValidator. */
27
27
final class CoreAdapterBuilder {
28
- @ SuppressWarnings ("rawtypes" )
29
- public static final ValidationAdapter NOOP = (type , req , propertyName ) -> true ;
30
28
31
29
private static final Set <Class <?>> DEFAULT_GROUP = Set .of (Default .class );
32
30
private final DValidator context ;
@@ -106,7 +104,7 @@ <T> ValidationAdapter<T> buildAnnotation(
106
104
}
107
105
}
108
106
// unknown annotations have noop
109
- return NOOP ;
107
+ return NoOpValidator . INSTANCE ;
110
108
}
111
109
112
110
record Request (
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ public <T> ValidationAdapter<T> adapter(Type type) {
164
164
@ Override
165
165
@ SuppressWarnings ("unchecked" )
166
166
public <T > ValidationAdapter <T > noop () {
167
- return CoreAdapterBuilder . NOOP ;
167
+ return NoOpValidator . INSTANCE ;
168
168
}
169
169
170
170
@ Override
Original file line number Diff line number Diff line change
1
+ package io .avaje .validation .core ;
2
+
3
+ import io .avaje .validation .adapter .ValidationAdapter ;
4
+ import io .avaje .validation .adapter .ValidationRequest ;
5
+
6
+ final class NoOpValidator implements ValidationAdapter , ValidationAdapter .Primitive {
7
+
8
+ static final NoOpValidator INSTANCE = new NoOpValidator ();
9
+
10
+ @ Override
11
+ public boolean validate (Object value , ValidationRequest req , String propertyName ) {
12
+ return true ;
13
+ }
14
+
15
+ @ Override
16
+ public Primitive primitive () {
17
+ return this ;
18
+ }
19
+
20
+ @ Override
21
+ public boolean validate (boolean value , ValidationRequest req , String propertyName ) {
22
+ return true ;
23
+ }
24
+
25
+ @ Override
26
+ public boolean validate (byte value , ValidationRequest req , String propertyName ) {
27
+ return true ;
28
+ }
29
+
30
+ @ Override
31
+ public boolean validate (char value , ValidationRequest req , String propertyName ) {
32
+ return true ;
33
+ }
34
+
35
+ @ Override
36
+ public boolean validate (double value , ValidationRequest req , String propertyName ) {
37
+ return true ;
38
+ }
39
+
40
+ @ Override
41
+ public boolean validate (float value , ValidationRequest req , String propertyName ) {
42
+ return true ;
43
+ }
44
+
45
+ @ Override
46
+ public boolean validate (int value , ValidationRequest req , String propertyName ) {
47
+ return true ;
48
+ }
49
+
50
+ @ Override
51
+ public boolean validate (long value , ValidationRequest req , String propertyName ) {
52
+ return true ;
53
+ }
54
+
55
+ @ Override
56
+ public boolean validate (short value , ValidationRequest req , String propertyName ) {
57
+ return true ;
58
+ }
59
+ }
You can’t perform that action at this time.
0 commit comments