org.everit.json.schema.ConstSchema Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of everit-json-schema Show documentation
Show all versions of everit-json-schema Show documentation
Implementation of the JSON Schema Core Draft v4 specification built with the org.json API
package org.everit.json.schema;
import static org.everit.json.schema.EnumSchema.toJavaValue;
import org.everit.json.schema.internal.JSONPrinter;
public class ConstSchema extends Schema {
public static class ConstSchemaBuilder extends Schema.Builder {
private Object permittedValue;
public ConstSchemaBuilder permittedValue(Object permittedValue) {
this.permittedValue = permittedValue;
return this;
}
@Override public ConstSchema build() {
return new ConstSchema(this);
}
}
public static ConstSchemaBuilder builder() {
return new ConstSchemaBuilder();
}
private final Object permittedValue;
protected ConstSchema(ConstSchemaBuilder builder) {
super(builder);
this.permittedValue = toJavaValue(builder.permittedValue);
}
@Override void describePropertiesTo(JSONPrinter writer) {
writer.key("const");
writer.value(this.permittedValue);
}
@Override void accept(Visitor visitor) {
visitor.visitConstSchema(this);
}
public Object getPermittedValue() {
return permittedValue;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy