Skip to content

Commit f7ff3d2

Browse files
committed
style cleanups (wip)
1 parent 8798998 commit f7ff3d2

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

core/src/main/java/org/everit/json/schema/ValidationException.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public ValidationException(final Schema violatedSchema, final Class<?> expectedT
6060
this(violatedSchema, new StringBuilder("#"),
6161
"expected type: " + expectedType.getSimpleName() + ", found: "
6262
+ (actualValue == null ? "null" : actualValue.getClass().getSimpleName()),
63-
Collections.emptyList());
63+
Collections.emptyList());
6464
}
6565

6666
private ValidationException(final Schema rootFailingSchema,
@@ -74,6 +74,13 @@ public ValidationException(final Schema violatedSchema, final String message) {
7474
this(violatedSchema, new StringBuilder("#"), message, Collections.emptyList());
7575
}
7676

77+
/***
78+
*
79+
* @param violatedSchema
80+
* @param pointerToViolation
81+
* @param message
82+
* @param causingExceptions
83+
*/
7784
public ValidationException(final Schema violatedSchema, final StringBuilder pointerToViolation,
7885
final String message,
7986
final List<ValidationException> causingExceptions) {
@@ -112,10 +119,29 @@ public Schema getViolatedSchema() {
112119
return violatedSchema;
113120
}
114121

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+
*/
115130
public ValidationException prepend(final String fragment) {
116131
return prepend(fragment, this.violatedSchema);
117132
}
118133

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+
*/
119145
public ValidationException prepend(final String fragment, final Schema violatedSchema) {
120146
Objects.requireNonNull(fragment, "fragment cannot be null");
121147
StringBuilder newPointer = this.pointerToViolation.insert(1, '/').insert(2, fragment);

0 commit comments

Comments
 (0)