Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions json-core/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
/target/
53 changes: 25 additions & 28 deletions json-core/src/main/java/io/apptik/json/AbstractValidator.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
package io.apptik.json;


public abstract class AbstractValidator implements Validator {

@Override
public boolean isValid(JsonElement el) {
//System.out.println("Started simple JsonSchema Validation using: " + this.getTitle());
return doValidate(el, null);
}

@Override
public String validate(JsonElement el) {
//System.out.println("Started JsonSchema Validation using: " + this.getTitle());
StringBuilder sb = new StringBuilder();
doValidate(el, sb);
return sb.toString();
}

@Override
public boolean validate(JsonElement el, StringBuilder sb) {
//System.out.println("Started full JsonSchema Validation using: " + this.getTitle());
return doValidate(el, sb);
}

protected abstract boolean doValidate(JsonElement el, StringBuilder sb);

@Override
public String getTitle() {
return getClass().getCanonicalName();
}
protected abstract boolean doValidate(JsonElement el, StringBuilder sb);

public String getTitle() {
return getClass().getCanonicalName();
}

public boolean isValid(final JsonElement el) {
// System.out.println("Started simple JsonSchema Validation using: " +
// this.getTitle());
return doValidate(el, null);
}

public String validate(final JsonElement el) {
// System.out.println("Started JsonSchema Validation using: " +
// this.getTitle());
StringBuilder sb = new StringBuilder();
doValidate(el, sb);
return sb.toString();
}

public boolean validate(final JsonElement el, final StringBuilder sb) {
// System.out.println("Started full JsonSchema Validation using: " +
// this.getTitle());
return doValidate(el, sb);
}
}

Loading