20
20
import com .fasterxml .jackson .databind .node .ObjectNode ;
21
21
import com .networknt .schema .annotation .JsonNodeAnnotation ;
22
22
import com .networknt .schema .i18n .DefaultMessageSource ;
23
+ import com .networknt .schema .i18n .MessageSource ;
23
24
24
25
import org .slf4j .Logger ;
25
26
29
30
import java .util .Set ;
30
31
import java .util .function .Consumer ;
31
32
33
+ /**
34
+ * Base {@link JsonValidator}.
35
+ */
32
36
public abstract class BaseJsonValidator extends ValidationMessageHandler implements JsonValidator {
33
37
protected final boolean suppressSubSchemaRetrieval ;
34
38
35
39
protected final JsonNode schemaNode ;
36
40
37
- protected ValidationContext validationContext ;
41
+ protected final ValidationContext validationContext ;
38
42
39
43
public BaseJsonValidator (SchemaLocation schemaLocation , JsonNodePath evaluationPath , JsonNode schemaNode ,
40
44
JsonSchema parentSchema , ValidatorTypeCode validatorType , ValidationContext validationContext ) {
@@ -60,15 +64,41 @@ public BaseJsonValidator(SchemaLocation schemaLocation, JsonNodePath evaluationP
60
64
}
61
65
62
66
/**
63
- * Copy constructor.
64
- *
65
- * @param copy to copy from
67
+ * Constructor to create a copy using fields.
68
+ *
69
+ * @param suppressSubSchemaRetrieval to suppress sub schema retrieval
70
+ * @param schemaNode the schema node
71
+ * @param validationContext the validation context
72
+ * @param errorMessageType the error message type
73
+ * @param customErrorMessagesEnabled whether custom error msessages are enabled
74
+ * @param messageSource the message source
75
+ * @param keyword the keyword
76
+ * @param parentSchema the parent schema
77
+ * @param schemaLocation the schema location
78
+ * @param evaluationPath the evaluation path
79
+ * @param evaluationParentSchema the evaluation parent schema
80
+ * @param errorMessage the error message
66
81
*/
67
- protected BaseJsonValidator (BaseJsonValidator copy ) {
68
- super (copy );
69
- this .suppressSubSchemaRetrieval = copy .suppressSubSchemaRetrieval ;
70
- this .schemaNode = copy .schemaNode ;
71
- this .validationContext = copy .validationContext ;
82
+ protected BaseJsonValidator (
83
+ /* Below from BaseJsonValidator */
84
+ boolean suppressSubSchemaRetrieval ,
85
+ JsonNode schemaNode ,
86
+ ValidationContext validationContext ,
87
+ /* Below from ValidationMessageHandler */
88
+ ErrorMessageType errorMessageType ,
89
+ boolean customErrorMessagesEnabled ,
90
+ MessageSource messageSource ,
91
+ Keyword keyword ,
92
+ JsonSchema parentSchema ,
93
+ SchemaLocation schemaLocation ,
94
+ JsonNodePath evaluationPath ,
95
+ JsonSchema evaluationParentSchema ,
96
+ Map <String , String > errorMessage ) {
97
+ super (errorMessageType , customErrorMessagesEnabled , messageSource , keyword ,
98
+ parentSchema , schemaLocation , evaluationPath , evaluationParentSchema , errorMessage );
99
+ this .suppressSubSchemaRetrieval = suppressSubSchemaRetrieval ;
100
+ this .schemaNode = schemaNode ;
101
+ this .validationContext = validationContext ;
72
102
}
73
103
74
104
private static JsonSchema obtainSubSchemaNode (final JsonNode schemaNode , final ValidationContext validationContext ) {
0 commit comments