Skip to content

Commit 142d92f

Browse files
committed
Rename JsonNodePath to NodePath
1 parent 19941fd commit 142d92f

File tree

98 files changed

+454
-454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+454
-454
lines changed

src/main/java/com/networknt/schema/Error.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@
4848
public class Error {
4949
private final String keyword;
5050
@JsonSerialize(using = ToStringSerializer.class)
51-
private final JsonNodePath evaluationPath;
51+
private final NodePath evaluationPath;
5252
@JsonSerialize(using = ToStringSerializer.class)
5353
private final SchemaLocation schemaLocation;
5454
@JsonSerialize(using = ToStringSerializer.class)
55-
private final JsonNodePath instanceLocation;
55+
private final NodePath instanceLocation;
5656
private final Object[] arguments;
5757
private final String messageKey;
5858
private final Supplier<String> messageSupplier;
5959
private final Map<String, Object> details;
6060
private final JsonNode instanceNode;
6161
private final JsonNode schemaNode;
6262

63-
Error(String keyword, JsonNodePath evaluationPath, SchemaLocation schemaLocation,
64-
JsonNodePath instanceLocation, Object[] arguments, Map<String, Object> details,
63+
Error(String keyword, NodePath evaluationPath, SchemaLocation schemaLocation,
64+
NodePath instanceLocation, Object[] arguments, Map<String, Object> details,
6565
String messageKey, Supplier<String> messageSupplier, JsonNode instanceNode, JsonNode schemaNode) {
6666
super();
6767
this.keyword = keyword;
@@ -82,7 +82,7 @@ public class Error {
8282
*
8383
* @return The path to the input json
8484
*/
85-
public JsonNodePath getInstanceLocation() {
85+
public NodePath getInstanceLocation() {
8686
return instanceLocation;
8787
}
8888

@@ -93,7 +93,7 @@ public JsonNodePath getInstanceLocation() {
9393
*
9494
* @return the evaluation path
9595
*/
96-
public JsonNodePath getEvaluationPath() {
96+
public NodePath getEvaluationPath() {
9797
return evaluationPath;
9898
}
9999

@@ -261,9 +261,9 @@ public static abstract class BuilderSupport<S> {
261261
public abstract S self();
262262

263263
protected String keyword;
264-
protected JsonNodePath evaluationPath;
264+
protected NodePath evaluationPath;
265265
protected SchemaLocation schemaLocation;
266-
protected JsonNodePath instanceLocation;
266+
protected NodePath instanceLocation;
267267
protected Object[] arguments;
268268
protected Map<String, Object> details;
269269
protected MessageFormat format;
@@ -303,7 +303,7 @@ public S index(Integer index) {
303303
* @param instanceLocation the instance location
304304
* @return the builder
305305
*/
306-
public S instanceLocation(JsonNodePath instanceLocation) {
306+
public S instanceLocation(NodePath instanceLocation) {
307307
this.instanceLocation = instanceLocation;
308308
return self();
309309
}
@@ -330,7 +330,7 @@ public S schemaLocation(SchemaLocation schemaLocation) {
330330
* @param evaluationPath the evaluation path
331331
* @return the builder
332332
*/
333-
public S evaluationPath(JsonNodePath evaluationPath) {
333+
public S evaluationPath(NodePath evaluationPath) {
334334
this.evaluationPath = evaluationPath;
335335
return self();
336336
}
@@ -420,15 +420,15 @@ protected String getKeyword() {
420420
return keyword;
421421
}
422422

423-
protected JsonNodePath getEvaluationPath() {
423+
protected NodePath getEvaluationPath() {
424424
return evaluationPath;
425425
}
426426

427427
protected SchemaLocation getSchemaLocation() {
428428
return schemaLocation;
429429
}
430430

431-
protected JsonNodePath getInstanceLocation() {
431+
protected NodePath getInstanceLocation() {
432432
return instanceLocation;
433433
}
434434

src/main/java/com/networknt/schema/ExecutionContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,14 @@ public DiscriminatorContext getCurrentDiscriminatorContext() {
191191
return null; // this is the case when we get on a schema that has a discriminator, but it's not used in anyOf
192192
}
193193

194-
public void enterDiscriminatorContext(final DiscriminatorContext ctx, @SuppressWarnings("unused") JsonNodePath instanceLocation) {
194+
public void enterDiscriminatorContext(final DiscriminatorContext ctx, @SuppressWarnings("unused") NodePath instanceLocation) {
195195
if (this.discriminatorContexts == null) {
196196
this.discriminatorContexts = new Stack<>();
197197
}
198198
this.discriminatorContexts.push(ctx);
199199
}
200200

201-
public void leaveDiscriminatorContextImmediately(@SuppressWarnings("unused") JsonNodePath instanceLocation) {
201+
public void leaveDiscriminatorContextImmediately(@SuppressWarnings("unused") NodePath instanceLocation) {
202202
this.discriminatorContexts.pop();
203203
}
204204

src/main/java/com/networknt/schema/Format.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ default boolean matches(ExecutionContext executionContext, SchemaContext schemaC
121121
* @return true if matches
122122
*/
123123
default boolean matches(ExecutionContext executionContext, SchemaContext schemaContext, JsonNode node,
124-
JsonNode rootNode, JsonNodePath instanceLocation, boolean assertionsEnabled, FormatValidator formatValidator) {
124+
JsonNode rootNode, NodePath instanceLocation, boolean assertionsEnabled, FormatValidator formatValidator) {
125125
return matches(executionContext, schemaContext, node);
126126
}
127127

@@ -140,7 +140,7 @@ default boolean matches(ExecutionContext executionContext, SchemaContext schemaC
140140
* @param formatValidator the format validator
141141
*/
142142
default void validate(ExecutionContext executionContext, SchemaContext schemaContext,
143-
JsonNode node, JsonNode rootNode, JsonNodePath instanceLocation, boolean assertionsEnabled,
143+
JsonNode node, JsonNode rootNode, NodePath instanceLocation, boolean assertionsEnabled,
144144
Supplier<MessageSourceError.Builder> message,
145145
FormatValidator formatValidator) {
146146
if (assertionsEnabled) {

src/main/java/com/networknt/schema/JsonNodePath.java renamed to src/main/java/com/networknt/schema/NodePath.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,31 @@
2020
/**
2121
* Represents a path to a JSON node.
2222
*/
23-
public class JsonNodePath implements Comparable<JsonNodePath> {
23+
public class NodePath implements Comparable<NodePath> {
2424
private final PathType type;
25-
private final JsonNodePath parent;
25+
private final NodePath parent;
2626

2727
private final String pathSegment;
2828
private final int pathSegmentIndex;
2929

3030
private volatile String value = null; // computed lazily
3131
private int hash = 0; // computed lazily
3232

33-
public JsonNodePath(PathType type) {
33+
public NodePath(PathType type) {
3434
this.type = type;
3535
this.parent = null;
3636
this.pathSegment = null;
3737
this.pathSegmentIndex = -1;
3838
}
3939

40-
private JsonNodePath(JsonNodePath parent, String pathSegment) {
40+
private NodePath(NodePath parent, String pathSegment) {
4141
this.parent = parent;
4242
this.type = parent.type;
4343
this.pathSegment = pathSegment;
4444
this.pathSegmentIndex = -1;
4545
}
4646

47-
private JsonNodePath(JsonNodePath parent, int pathSegmentIndex) {
47+
private NodePath(NodePath parent, int pathSegmentIndex) {
4848
this.parent = parent;
4949
this.type = parent.type;
5050
this.pathSegment = null;
@@ -56,7 +56,7 @@ private JsonNodePath(JsonNodePath parent, int pathSegmentIndex) {
5656
*
5757
* @return the parent
5858
*/
59-
public JsonNodePath getParent() {
59+
public NodePath getParent() {
6060
return this.parent;
6161
}
6262

@@ -66,8 +66,8 @@ public JsonNodePath getParent() {
6666
* @param token the child token
6767
* @return the path
6868
*/
69-
public JsonNodePath append(String token) {
70-
return new JsonNodePath(this, token);
69+
public NodePath append(String token) {
70+
return new NodePath(this, token);
7171
}
7272

7373
/**
@@ -76,8 +76,8 @@ public JsonNodePath append(String token) {
7676
* @param index the index
7777
* @return the path
7878
*/
79-
public JsonNodePath append(int index) {
80-
return new JsonNodePath(this, index);
79+
public NodePath append(int index) {
80+
return new NodePath(this, index);
8181
}
8282

8383
/**
@@ -133,7 +133,7 @@ public Object getElement(int index) {
133133
if (count < 0) {
134134
throw new IllegalArgumentException("");
135135
}
136-
JsonNodePath current = this;
136+
NodePath current = this;
137137
for (int x = 0; x < count; x++) {
138138
current = current.parent;
139139
}
@@ -157,7 +157,7 @@ public int getNameCount() {
157157
* @param other the other path
158158
* @return true if the path starts with the other path
159159
*/
160-
public boolean startsWith(JsonNodePath other) {
160+
public boolean startsWith(NodePath other) {
161161
int count = getNameCount();
162162
int otherCount = other.getNameCount();
163163

@@ -166,7 +166,7 @@ public boolean startsWith(JsonNodePath other) {
166166
} else if (otherCount == count) {
167167
return this.equals(other);
168168
} else {
169-
JsonNodePath compare = this;
169+
NodePath compare = this;
170170
int x = count - otherCount;
171171
while (x > 0) {
172172
compare = compare.getParent();
@@ -189,7 +189,7 @@ public boolean contains(String segment) {
189189
if (result) {
190190
return true;
191191
}
192-
JsonNodePath path = this.getParent();
192+
NodePath path = this.getParent();
193193
while (path != null) {
194194
if (segment.equals(path.pathSegment)) {
195195
return true;
@@ -232,13 +232,13 @@ public boolean equals(Object obj) {
232232
return false;
233233
if (getClass() != obj.getClass())
234234
return false;
235-
JsonNodePath other = (JsonNodePath) obj;
235+
NodePath other = (NodePath) obj;
236236
return Objects.equals(pathSegment, other.pathSegment) && pathSegmentIndex == other.pathSegmentIndex
237237
&& type == other.type && Objects.equals(parent, other.parent);
238238
}
239239

240240
@Override
241-
public int compareTo(JsonNodePath other) {
241+
public int compareTo(NodePath other) {
242242
if (this.parent != null && other.parent == null) {
243243
return 1;
244244
} else if (this.parent == null && other.parent != null) {

0 commit comments

Comments
 (0)