Package | Description |
---|---|
com.sdicons.json.validator |
Validating a JSON model with validation rules.
|
com.sdicons.json.validator.predicates |
The building blocks to create validation expressions.
|
Modifier and Type | Class and Description |
---|---|
class |
JSONValidator
A validator that accepts a validator description in JSON format.
|
Modifier and Type | Method and Description |
---|---|
Validator |
ValidatorBuilder.and(String ruleName,
Validator... validators)
Create a named and-combination
And of a series of validators. |
Validator |
ValidatorBuilder.and(Validator... validators)
Create an anonymous and-combination
And of a series of validators. |
Validator |
ValidatorBuilder.array()
Create an anonymous
Array validator. |
Validator |
ValidatorBuilder.array(String ruleName)
Create a named
Array validator. |
Validator |
ValidatorBuilder.bool()
Create an anonymous
Bool validator. |
Validator |
ValidatorBuilder.bool(String ruleName)
Create a named
Bool validator. |
static Validator |
ValidatorUtil.buildValidator(JSONValue aVal) |
static Validator |
ValidatorUtil.buildValidator(JSONValue aVal,
HashMap<String,Validator> aRuleset) |
Validator |
ValidatorBuilder.complex()
Create an anonymus
Complex validator to check if a value is
an array or an object. |
Validator |
ValidatorBuilder.complex(String ruleName)
Create a named
Complex validator to check if a value is
an array or an object. |
Validator |
ValidatorBuilder.content(String ruleName,
Validator rule)
Create a named
Content validator that puts constraints on
the contents of an array or an object. |
Validator |
ValidatorBuilder.content(Validator rule)
Create an anonymous
Content validator that puts constraints on
the contents of an array or an object. |
Validator |
ValidatorBuilder.decimal()
Create an anonymous
Decimal validator to check if a value contains a decimal. |
Validator |
ValidatorBuilder.decimal(String ruleName)
Create a named
Decimal validator to check if a value is a decimal. |
Validator |
ValidatorBuilder.enumeration(JSONValue... values)
Create an anonymous
Enumeration validation rule. |
Validator |
ValidatorBuilder.enumeration(String... values)
A convenience method to create a named
Enumeration validation using a set of String values. |
Validator |
ValidatorBuilder.enumeration(String ruleName,
JSONValue... values)
Create a named
Enumeration validation rule. |
Validator |
ValidatorBuilder.enumeration(String ruleName,
String... values)
A convenience method to create a named
Enumeration validation using a set of String values. |
Validator |
ValidatorBuilder.falsep()
Create an anonymous
False validatioin rule that always fails. |
Validator |
ValidatorBuilder.falsep(String ruleName)
Create a named
False validation rule that always fails. |
Validator |
ValidatorBuilder.getRule(String ruleName)
Get a named validator that was previously built using this builder.
|
Validator |
ValidatorBuilder.intp()
Create an anonymous
Int validation rule. |
Validator |
ValidatorBuilder.intp(String ruleName)
Create a named
Int validation rule. |
Validator |
ValidatorBuilder.length(Integer min,
Integer max)
Create an anonymous
Length validation rule to check the length of an array or a string. |
Validator |
ValidatorBuilder.length(String ruleName,
Integer min,
Integer max)
Create a named
Length validator to check the length of an array or a string. |
Validator |
ValidatorBuilder.not(String ruleName,
Validator rule)
Create a named logical
Not validation which flips the result of an inner validation. |
Validator |
ValidatorBuilder.not(Validator rule)
Create an anonymous logical
Not validation which reverses the result of an inner validation. |
Validator |
ValidatorBuilder.nr()
Create an anonymous
Nr validator to see if a value is a number. |
Validator |
ValidatorBuilder.nr(String ruleName)
Create a named
Nr validator to see if a value is a number. |
Validator |
ValidatorBuilder.nullp()
Create an anonymous
Null checking validator. |
Validator |
ValidatorBuilder.nullp(String ruleName)
Create a named
Null checking validator. |
Validator |
ValidatorBuilder.object()
Create an anonymous
Object validator to check if a value
is an object |
Validator |
ValidatorBuilder.object(String ruleName)
Create a named
Object validator to check if a value
is an object. |
Validator |
ValidatorBuilder.or(String ruleName,
Validator... validators)
Create a named composite
Or validation. |
Validator |
ValidatorBuilder.or(Validator... validators)
Create an anonymous
Or validation rule. |
Validator |
ValidatorBuilder.properties(Properties.PropRule... rules)
Create an anonymous
Properties validator to check the key/value pairs of an object. |
Validator |
ValidatorBuilder.properties(String ruleName,
Properties.PropRule... rules)
Create a named
Properties validator to check the key/value pairs of an object. |
Validator |
ValidatorBuilder.range(Integer min,
Integer max)
An anonymous
Range validator. |
Validator |
ValidatorBuilder.range(String ruleName,
Integer min,
Integer max)
Create a named
Range validator. |
Validator |
ValidatorBuilder.ref(String ref)
Create an anonymous
Ref validator. |
Validator |
ValidatorBuilder.ref(String ruleName,
String ref)
Create a named
Ref validator. |
Validator |
ValidatorBuilder.regexp(String pattern)
Create an anonymous
Regexp validator to validate strings against regular expressions. |
Validator |
ValidatorBuilder.regexp(String ruleName,
String pattern)
Create a named
Regexp validator to validate strings against regular expressions. |
Validator |
ValidatorBuilder.simple()
Create an anonymous
Simple validator to check that a value is atomic. |
Validator |
ValidatorBuilder.simple(String ruleName)
Create a named
Simple validator to check that a value is atomic. |
Validator |
ValidatorBuilder.string()
Create an anonymous
Str validator to check if a value is a string. |
Validator |
ValidatorBuilder.string(String ruleName)
Create a named
Str validator to check if a value is a string. |
Validator |
ValidatorBuilder.switchrule(String ruleName,
String discriminator,
Switch.SwitchCase... cases)
Create a named
Switch validator. |
Validator |
ValidatorBuilder.switchrule(String discriminator,
Switch.SwitchCase... cases)
Create an anonymous
Switch validator. |
Validator |
ValidatorBuilder.truep()
Create an anonymous
True validation rule that always succeeds. |
Validator |
ValidatorBuilder.truep(String ruleName)
Create a named
True validation rule that always succeeds. |
Modifier and Type | Method and Description |
---|---|
Validator |
ValidatorBuilder.and(String ruleName,
Validator... validators)
Create a named and-combination
And of a series of validators. |
Validator |
ValidatorBuilder.and(Validator... validators)
Create an anonymous and-combination
And of a series of validators. |
Validator |
ValidatorBuilder.content(String ruleName,
Validator rule)
Create a named
Content validator that puts constraints on
the contents of an array or an object. |
Validator |
ValidatorBuilder.content(Validator rule)
Create an anonymous
Content validator that puts constraints on
the contents of an array or an object. |
Validator |
ValidatorBuilder.not(String ruleName,
Validator rule)
Create a named logical
Not validation which flips the result of an inner validation. |
Validator |
ValidatorBuilder.not(Validator rule)
Create an anonymous logical
Not validation which reverses the result of an inner validation. |
Validator |
ValidatorBuilder.or(String ruleName,
Validator... validators)
Create a named composite
Or validation. |
Validator |
ValidatorBuilder.or(Validator... validators)
Create an anonymous
Or validation rule. |
static Properties.PropRule |
ValidatorBuilder.propRule(String propName,
Validator rule,
boolean optional)
Create a
Properties.PropRule that is used to build a Properties validator for objects. |
static Switch.SwitchCase |
ValidatorBuilder.switchcase(Validator rule,
JSONValue... values)
Create a
Switch.SwitchCase that can be used to build a Switch validator. |
Modifier and Type | Method and Description |
---|---|
static Validator |
ValidatorUtil.buildValidator(JSONValue aVal,
HashMap<String,Validator> aRuleset) |
Modifier and Type | Class and Description |
---|---|
class |
And
This predicate represents the logical AND combination of a number of other predicates.
|
class |
Array
A predicate to check if a JSON value is an array.
|
class |
Bool
A predicate to check if a value is a boolean.
|
class |
Complex
A predicate to check if a JSON value is a JSONObject or a JSONArray.
|
class |
Content
A predicate that checks if all elements of a complex JSON structure JSONObject or
JSONArray comply to another named predicate.
|
class |
CustomPredicate
A predicate that uses a Java implementation of CustomValidator.
|
class |
CustomValidator
The super class of all custom Java validators.
|
class |
Decimal
Check if a JSON value is a JSON decimal or not.
|
class |
Enumeration
This predicate checks if the JSON value is one of the set of values
specified by this rule.
|
class |
False
This rule always fails.
|
class |
Int
A predicate to check if a JSON value is an integer or not.
|
class |
Length
A bounds check on the number of elements in a
JSONArray , the length of a JSONString or the number of properties in a JSONObject . |
class |
Let
It is a convenience rule that lets you specify a list of global shared
validation rules in advance before using these later on.
|
class |
Not
This predicate is a negation of another one.
|
class |
Nr
A predicate to test if a
JSONValue is a number representation, in JSON there are two viz. |
class |
Null
|
class |
Object
This predicate tests if a
JSONValue is a JSONObject or not. |
class |
Or
This predicate represents the logical OR combination of a number of other predicates.
|
class |
Predicate
A super class for our validators.
|
class |
Properties
Predicate to subject the properties of a
JSONObject to some tests. |
class |
Range
A predicate to see if a
JSONNumber falls in the required range. |
class |
Ref
A rule that uses a named rule that was defined earlier.
|
class |
Regexp
Test if a
JSONString matches a regexp pattern. |
class |
Simple
This predicate tests whether a
JSONValue is a simple value, one of JSONString , JSONBoolean ,
JSONDecimal , JSONInteger or JSONNull . |
class |
Str
Test to see if a
JSONValue is a JSONString . |
class |
Switch
The switch validator is a convenience one.
|
class |
True
This rule always succeeds.
|
Modifier and Type | Method and Description |
---|---|
Validator |
Properties.PropRule.getRule() |
Validator |
Switch.SwitchCase.getValidator() |
Modifier and Type | Method and Description |
---|---|
protected HashMap<String,Validator> |
CustomValidator.getRuleset() |
Constructor and Description |
---|
And(String aName,
Validator... validators) |
Content(String aName,
Validator rule) |
Not(String aName,
Validator rule) |
Or(String aName,
Validator... validators) |
Properties.PropRule(String key,
Validator rule,
boolean optional) |
Switch.SwitchCase(JSONValue when,
Validator validator) |
Switch.SwitchCase(List<JSONValue> when,
Validator validator) |
Copyright © 2012. All Rights Reserved.