@@ -60,7 +60,7 @@ public ValidationException(final Schema violatedSchema, final Class<?> expectedT
60
60
this (violatedSchema , new StringBuilder ("#" ),
61
61
"expected type: " + expectedType .getSimpleName () + ", found: "
62
62
+ (actualValue == null ? "null" : actualValue .getClass ().getSimpleName ()),
63
- Collections .emptyList ());
63
+ Collections .emptyList ());
64
64
}
65
65
66
66
private ValidationException (final Schema rootFailingSchema ,
@@ -74,6 +74,13 @@ public ValidationException(final Schema violatedSchema, final String message) {
74
74
this (violatedSchema , new StringBuilder ("#" ), message , Collections .emptyList ());
75
75
}
76
76
77
+ /***
78
+ *
79
+ * @param violatedSchema
80
+ * @param pointerToViolation
81
+ * @param message
82
+ * @param causingExceptions
83
+ */
77
84
public ValidationException (final Schema violatedSchema , final StringBuilder pointerToViolation ,
78
85
final String message ,
79
86
final List <ValidationException > causingExceptions ) {
@@ -112,10 +119,29 @@ public Schema getViolatedSchema() {
112
119
return violatedSchema ;
113
120
}
114
121
122
+ /**
123
+ * Creates a new {@code ViolationException} instance based on this one, but with changed
124
+ * {@link #getPointerToViolation() JSON pointer}.
125
+ *
126
+ * @param fragment
127
+ * the fragment of the JSON pointer to be prepended to existing pointers
128
+ * @return the new instance
129
+ */
115
130
public ValidationException prepend (final String fragment ) {
116
131
return prepend (fragment , this .violatedSchema );
117
132
}
118
133
134
+ /**
135
+ * Creates a new {@code ViolationException} instance based on this one, but with changed
136
+ * {@link #getPointerToViolation() JSON pointer} and {link {@link #getViolatedSchema() violated
137
+ * schema}.
138
+ *
139
+ * @param fragment
140
+ * the fragment of the JSON pointer to be prepended to existing pointers
141
+ * @param violatedSchema
142
+ * the violated schema, which may not be the same as {@link #getViolatedSchema()}
143
+ * @return the new {@code ViolationException} instance
144
+ */
119
145
public ValidationException prepend (final String fragment , final Schema violatedSchema ) {
120
146
Objects .requireNonNull (fragment , "fragment cannot be null" );
121
147
StringBuilder newPointer = this .pointerToViolation .insert (1 , '/' ).insert (2 , fragment );
0 commit comments