public abstract class FormatSpecifier extends Object
The format keyword always takes a string as an argument, and this
string is called a "specifier". The draft defines specifiers for recognizing
URIs, phone numbers, different date formats, and so on -- and even CSS 2.1
colors and styles(not supported).
One important thing to remember is that a specifier will only validate a
given subset of JSON instance types (for instance, uri only validates
string instances). In the event that the instane type is not of the
validated types, validation succeeds.
The spec allows for custom specifiers to be added. This implementation, however, does not support it.
| Modifier and Type | Field and Description |
|---|---|
private EnumSet<NodeType> |
typeSet
JSON instance types which this specifier can validate
|
| Modifier | Constructor and Description |
|---|---|
protected |
FormatSpecifier(NodeType first,
NodeType... other)
Protected constructor
|
protected FormatSpecifier(NodeType first, NodeType... other)
Its arguments are the node types recognized by the specifier. Only
one specifier recognizes more than one type: utc-millisec (it
can validate both numbers and integers).
first - first typeother - other types, if anypublic final void validate(List<String> messages, JsonNode value)
This function only checks whether the value is of a type recognized
by this specifier. If so, it call checkValue(List, JsonNode).
messages - the list of messages to fillvalue - the value to validateabstract void checkValue(List<String> messages, JsonNode value)
It is only called if the value type is one expected by the
specifier, see validate(List, JsonNode).
messages - the list of messages to fillvalue - the value to validateCopyright © 2012. All Rights Reserved.