File tree Expand file tree Collapse file tree 4 files changed +23
-9
lines changed
main/java/com/networknt/schema
test/java/com/networknt/schema Expand file tree Collapse file tree 4 files changed +23
-9
lines changed Original file line number Diff line number Diff line change
1
+ package com .networknt .schema ;
2
+
3
+ public abstract class AbstractCollector <E > implements Collector <E >{
4
+
5
+ @ Override
6
+ public void combine (Object object ) {
7
+ // Do nothing. This is the default Implementation.
8
+ }
9
+ }
Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ public interface Collector<E> {
15
15
* method and could be used when the same collector is used for collecting data
16
16
* at multiple touch points or accumulating data at same touch point.
17
17
*/
18
- public default void combine (Object object ) {
19
- };
18
+ public void combine (Object object );
20
19
21
20
/**
22
21
* Final method called by the framework that returns the actual collected data.
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public static CollectorContext getInstance() {
33
33
/**
34
34
*
35
35
* Adds a collector with give name. Preserving this method for backward
36
- * compatibility . *
36
+ * compatibility.
37
37
*
38
38
* @param <E>
39
39
* @param name
Original file line number Diff line number Diff line change 1
1
package com .networknt .schema ;
2
2
3
- import com .fasterxml .jackson .core .JsonProcessingException ;
4
- import com .fasterxml .jackson .databind .JsonMappingException ;
5
- import com .fasterxml .jackson .databind .JsonNode ;
6
- import com .fasterxml .jackson .databind .ObjectMapper ;
3
+ import java .util .ArrayList ;
4
+ import java .util .HashMap ;
5
+ import java .util .List ;
6
+ import java .util .Map ;
7
+ import java .util .Set ;
8
+ import java .util .TreeSet ;
9
+
7
10
import org .junit .Assert ;
8
11
import org .junit .Before ;
9
12
import org .junit .Test ;
10
13
11
- import java .util .*;
14
+ import com .fasterxml .jackson .core .JsonProcessingException ;
15
+ import com .fasterxml .jackson .databind .JsonMappingException ;
16
+ import com .fasterxml .jackson .databind .JsonNode ;
17
+ import com .fasterxml .jackson .databind .ObjectMapper ;
12
18
13
19
public class CollectorContextTest {
14
20
@@ -274,7 +280,7 @@ public Set<ValidationMessage> validate(JsonNode rootNode) {
274
280
275
281
}
276
282
277
- private class CustomCollector implements Collector <List <String >> {
283
+ private class CustomCollector extends AbstractCollector <List <String >> {
278
284
279
285
List <String > returnList = new ArrayList <String >();
280
286
You can’t perform that action at this time.
0 commit comments