
org.jsonddl.model.Schema Maven / Gradle / Ivy
package org.jsonddl.model;
/**
* A Schema is the top-level object that encapsulates the normalized form of
* a json-ddl schema.
*/
@javax.annotation.Generated(value="org.jsonddl.generator.Generator", date="2011-11-18T23:32:13")
public interface Schema extends org.jsonddl.JsonDdlObject {
/**
* A map of object models by simple name.
*/
java.util.Map getModels();
public static class Builder implements org.jsonddl.JsonDdlObject.Builder, org.jsonddl.impl.Traversable, Schema {
private SchemaImpl obj;
public Builder() {this(new SchemaImpl());}
Builder(SchemaImpl instance) {this.obj = instance;}
public Schema.Builder builder() { return this; }
public Class getDdlObjectType() { return Schema.class;}
public Schema.Builder newInstance() { return new Schema.Builder(); }
public java.util.Map toJsonObject() { return obj.toJsonObject(); }
public java.util.Map getModels() { return obj.models; }
public void setModels(java.util.Map value) { withModels(value);}
public Schema.Builder withModels(java.util.Map value) { obj.models = value;return this;}
public Schema.Builder accept(org.jsonddl.JsonDdlVisitor visitor) {
obj = new org.jsonddl.impl.ContextImpl.ObjectContext.Builder().withValue(this).withKind(org.jsonddl.model.Kind.DDL).withMutability(true).build().traverse(visitor).builder().obj;
return this;
}
public Schema build() {
SchemaImpl toReturn = obj;
obj = null;
toReturn.models = org.jsonddl.impl.Protected.object(toReturn.models);
return toReturn;
}
public Schema.Builder from(Schema from) {
withModels(from.getModels());
return this;}
public Schema.Builder from(java.util.Map map){
accept(org.jsonddl.impl.JsonMapVisitor.fromJsonMap(map));
return this;
}
public Schema.Builder traverse(org.jsonddl.JsonDdlVisitor visitor) {
withModels(
new org.jsonddl.impl.ContextImpl.MapContext.Builder()
.withKind(org.jsonddl.model.Kind.MAP)
.withNestedKinds(java.util.Arrays.asList(org.jsonddl.model.Kind.STRING, org.jsonddl.model.Kind.DDL))
.withLeafType(Model.class)
.withMutability(true)
.withProperty("models")
.withValue(obj.models)
.build().traverse(visitor));
return this;
}
}
Builder builder();
Builder newInstance();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy