public class SchemaBuilderImpl extends Object implements SchemaBuilder
SchemaBuilder implementation
Listing outstanding items here instead of in the API
TODO add mark/unmark or current support to navigate previous builders
TODO support customer ObjectMapper
TODO support "additionalItems" for array type
TODO support nested array definition for array type
TODO support "definitions"
TODO support "patternProperties"
TODO support "dependencies"
TODO support "allOf"
TODO support "anyOf"
TODO support "oneOf"
TODO support "not"
TODO support "default"| Modifier and Type | Field and Description |
|---|---|
protected com.boomi.util.json.schema.impl.BoomiAnnotations |
_annotations |
protected ObjectNode |
_root |
protected static String |
SCHEMA_DESCRIPTION |
protected static String |
SCHEMA_EXCLUSIVE_MAXIMUM |
protected static String |
SCHEMA_EXCLUSIVE_MINIMUM |
protected static String |
SCHEMA_FORMAT |
protected static String |
SCHEMA_MAX_ITEMS |
protected static String |
SCHEMA_MAX_LENGTH |
protected static String |
SCHEMA_MAX_PROPERTIES |
protected static String |
SCHEMA_MAXIMUM |
protected static String |
SCHEMA_MIN_ITEMS |
protected static String |
SCHEMA_MIN_LENGTH |
protected static String |
SCHEMA_MIN_PROPERTIES |
protected static String |
SCHEMA_MINIMUM |
protected static String |
SCHEMA_MULTIPLE_OF |
protected static String |
SCHEMA_PATTERN |
protected static String |
SCHEMA_REQUIRED |
protected static String |
SCHEMA_UNIQUE_ITEMS |
| Constructor and Description |
|---|
SchemaBuilderImpl()
Creates a new instance using
JSONUtil.getDefaultObjectMapper(). |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAttribute(String name,
boolean value) |
protected void |
addAttribute(String name,
int value) |
protected void |
addAttribute(String name,
String value) |
FieldSpecBuilder<T> |
buildFieldSpec(String name)
Builder method to add a new "boomi_fieldSpec" annotation to the current
object.
|
ElementTypeBuilder<T> |
buildProperty(String name)
Builder method to add a new property to the document.
|
P |
finish()
This method finalizes the current builder and the returns its parent
builder (i.e, the builder that was used to create the current builder).
|
ObjectNode |
getObjectRoot()
This method returns the root
JsonNode of the current builder. |
ObjectNode |
getProperties()
This method returns the "properties" node of the object definition which
is where any nestesd definitions should be defined.
|
JsonNode |
getSchema()
This method returns the schema document as a
JsonNode. |
protected T |
getThis()
Returns the current builder instance.
|
void |
reset()
This method removes any attributes that have been added and returns the
schema document to its original state.
|
T |
withDescription(String value)
This method includes the "description" attribute in the current type
definition.
|
T |
withId(String value)
This method includes the "id" attribute in the current type definition.
|
T |
withIgnoreForFilters(boolean value)
This method includes the "ignoreForFilters" boomi field spec annotation
in the current type definition.
|
T |
withIgnoreForSelection(boolean value)
This method includes the "ignoreForSelection" boomi field spec annotation
in the current type definition.
|
T |
withIgnoreForSort(boolean value)
This method includes the "ignoreForSort" boomi field spec annotation in
the current type definition.
|
T |
withMaxProperties(int value)
This method includes the "maxProperties" attribute in the object type
definition
|
T |
withMinProperties(int value)
This method includes the "minProperties" attribute in the object type
definition
|
T |
withRequired(String... values)
This method includes the "required" attribute in the object type
definition
|
T |
withTitle(String value)
This method includes the "title" attribute in the current type
definition.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildFieldSpec, buildProperty, withMaxProperties, withMinProperties, withRequiredgetObjectRootwithDescription, withId, withIgnoreForFilters, withIgnoreForSelection, withIgnoreForSort, withTitleprotected static final String SCHEMA_MIN_PROPERTIES
protected static final String SCHEMA_MAX_PROPERTIES
protected static final String SCHEMA_UNIQUE_ITEMS
protected static final String SCHEMA_MULTIPLE_OF
protected static final String SCHEMA_PATTERN
protected static final String SCHEMA_MIN_ITEMS
protected static final String SCHEMA_MAX_ITEMS
protected static final String SCHEMA_MIN_LENGTH
protected static final String SCHEMA_MAX_LENGTH
protected static final String SCHEMA_EXCLUSIVE_MAXIMUM
protected static final String SCHEMA_EXCLUSIVE_MINIMUM
protected static final String SCHEMA_MINIMUM
protected static final String SCHEMA_MAXIMUM
protected static final String SCHEMA_FORMAT
protected static final String SCHEMA_REQUIRED
protected static final String SCHEMA_DESCRIPTION
protected final ObjectNode _root
protected final com.boomi.util.json.schema.impl.BoomiAnnotations _annotations
public SchemaBuilderImpl()
JSONUtil.getDefaultObjectMapper().
Sets the schema type to object and the $schema to
JSONUtil.SchemaVersion#DRAFT_04.public JsonNode getSchema()
SchemaBuilderJsonNode. The method
can be called multiple times and will return the current state of the
schema.getSchema in interface SchemaBuilderpublic void reset()
SchemaBuilderreset in interface SchemaBuilderpublic FieldSpecBuilder<T> buildFieldSpec(String name)
ComplexTypeBuilderbuildFieldSpec in interface ComplexTypeBuilder<T extends ComplexTypeBuilder<T>>name - the name of the field specFieldSpecBuilder instance that can be used to continue
building on the field specpublic ObjectNode getProperties()
public ElementTypeBuilder<T> buildProperty(String name)
ComplexTypeBuilderComplexTypeBuilder instance. The method will return an
ElementTypeBuilder instance that can be used to obtain a builder
for desired property type. A call to NestedBuilder.finish() on
the type specific builder will return the original builder instance. The
property will be replaced if this method is called multiple times with
the same name.buildProperty in interface ComplexTypeBuilder<T extends ComplexTypeBuilder<T>>name - the name of the propertyArrayTypeBuilder instance that can be used to continue
building on the array propertypublic T withRequired(String... values)
ComplexTypeBuilderwithRequired in interface ComplexTypeBuilder<T extends ComplexTypeBuilder<T>>values - the value array of the attributeObjectTypeBuilder instancepublic T withMaxProperties(int value)
ComplexTypeBuilderwithMaxProperties in interface ComplexTypeBuilder<T extends ComplexTypeBuilder<T>>ObjectTypeBuilder instancepublic T withMinProperties(int value)
ComplexTypeBuilderwithMinProperties in interface ComplexTypeBuilder<T extends ComplexTypeBuilder<T>>ObjectTypeBuilder instancepublic P finish()
NestedBuilderfinish in interface NestedBuilder<P extends NestingBuilder>public T withId(String value)
CommonBuilderwithId in interface CommonBuilder<T extends CommonBuilder<T>>value - the value of the attributepublic T withDescription(String value)
CommonBuilderwithDescription in interface CommonBuilder<T extends CommonBuilder<T>>value - the value of the attributepublic T withIgnoreForFilters(boolean value)
CommonBuilderwithIgnoreForFilters in interface CommonBuilder<T extends CommonBuilder<T>>value - the value of the attributepublic T withIgnoreForSelection(boolean value)
CommonBuilderwithIgnoreForSelection in interface CommonBuilder<T extends CommonBuilder<T>>value - the value of the attributepublic T withIgnoreForSort(boolean value)
CommonBuilderwithIgnoreForSort in interface CommonBuilder<T extends CommonBuilder<T>>value - the value of the attributepublic ObjectNode getObjectRoot()
NestingBuilderJsonNode of the current builder.getObjectRoot in interface NestingBuilderpublic T withTitle(String value)
CommonBuilderwithTitle in interface CommonBuilder<T extends CommonBuilder<T>>value - the value of the attributeprotected void addAttribute(String name, int value)
protected void addAttribute(String name, boolean value)
protected final T getThis()
return this; has some
weirdness because of the generic typing