java.lang.Object
jsonvalues.spec.JsSpecs
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic JsSpec
any()
spec that is conformed by any valuestatic JsSpec
returns a spec that conforms any value that is evaluated to true on the predicate.static JsArraySpec
array()
non-nullable array specstatic JsArraySpec
non-nullable array, where each element of the array satisfies the given predicatestatic JsArraySpec
non-nullable array of integral numbers specstatic JsArraySpec
arrayOfBigInt
(int minLength, int maxLength) returns an array of big integers specstatic JsArraySpec
arrayOfBigInt
(Predicate<BigInteger> predicate) non-nullable array of integral numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfBigInt
(Predicate<BigInteger> predicate, int minLength, int maxLength) non-nullable array of integral numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfBigIntSuchThat
(Predicate<JsArray> predicate) non-nullable array of integral numbers that satisfies the given predicatestatic JsArraySpec
non-nullable array of booleans specstatic JsArraySpec
arrayOfBool
(int minLength, int maxLength) returns an array of boolean specstatic JsArraySpec
arrayOfBoolSuchThat
(Predicate<JsArray> predicate) non-nullable array of booleans that satisfies the given predicatestatic JsArraySpec
non-nullable array of decimal numbers specstatic JsArraySpec
arrayOfDec
(int minLength, int maxLength) returns an array of decimal numbers specstatic JsArraySpec
arrayOfDec
(Predicate<BigDecimal> predicate) non-nullable array of decimal numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfDec
(Predicate<BigDecimal> predicate, int minLength, int maxLength) non-nullable array of decimal numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfDecSuchThat
(Predicate<JsArray> predicate) non-nullable array of decimal numbers that satisfies the given predicatestatic JsArraySpec
non-nullable array of integer numbers specstatic JsArraySpec
arrayOfInt
(int minLength, int maxLength) returns an array of integers specstatic JsArraySpec
arrayOfInt
(IntPredicate predicate) non-nullable array of integer numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfInt
(IntPredicate predicate, int minLength, int maxLength) non-nullable array of integer numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfIntSuchThat
(Predicate<JsArray> predicate) non-nullable array of numbers that satisfies the given predicatestatic JsArraySpec
non-nullable array of long numbers specstatic JsArraySpec
arrayOfLong
(int minLength, int maxLength) returns an array of longs specstatic JsArraySpec
arrayOfLong
(LongPredicate predicate) non-nullable array of long numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfLong
(LongPredicate predicate, int minLength, int maxLength) non-nullable array of long numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfLongSuchThat
(Predicate<JsArray> predicate) non-nullable array of long numbers that satisfies the given predicatestatic JsArraySpec
non-nullable array of numbers specstatic JsArraySpec
arrayOfNumber
(int minLength, int maxLength) returns an array of numbers specstatic JsArraySpec
arrayOfNumber
(Predicate<JsNumber> predicate) non-nullable array of numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfNumber
(Predicate<JsNumber> predicate, int minLength, int maxLength) non-nullable array of numbers, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfNumberSuchThat
(Predicate<JsArray> predicate) non-nullable array of numbers that satisfies the given predicatestatic JsArraySpec
non-nullable array of objects specstatic JsArraySpec
arrayOfObj
(int minLength, int maxLength) returns an array of objects specstatic JsArraySpec
arrayOfObj
(Predicate<JsObj> predicate) non-nullable array of objects, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfObj
(Predicate<JsObj> predicate, int minLength, int maxLength) non-nullable array of objects, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfObjSpec
(JsObjSpec spec) A required and none nullable spec that specifies an array of objects that conform the given specstatic JsArraySpec
arrayOfObjSpec
(JsObjSpec spec, int minLength, int maxLength) A required and none nullable spec that specifies an array of objects that conform the given specstatic JsArraySpec
arrayOfObjSuchThat
(Predicate<JsArray> predicate) non-nullable array of objects that satisfies the given predicatestatic JsArraySpec
non-nullable array of strings specstatic JsArraySpec
arrayOfStr
(int minLength, int maxLength) returns an array of strings specstatic JsArraySpec
arrayOfStr
(Predicate<String> predicate) non-nullable array of strings, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfStr
(Predicate<String> predicate, int minLength, int maxLength) non-nullable array of strings, where each element of the array satisfies the given predicatestatic JsArraySpec
arrayOfStrSuchThat
(Predicate<JsArray> predicate) non-nullable array of strings that satisfies the given predicatestatic JsArraySpec
arraySuchThat
(Predicate<JsArray> predicate) non-nullable array that satisfies the given predicatestatic JsSpec
non-nullable integral numberstatic JsSpec
bigInteger
(Predicate<BigInteger> predicate) non-nullable integral number that satisfies the given predicatestatic JsSpec
binary()
non-nullable array specstatic JsSpec
non-nullable json object that satisfies the given predicatestatic JsSpec
bool()
non-nullable booleanstatic JsSpec
a required and non nullable spec that specifies a constantstatic JsSpec
decimal()
non-nullable decimal numberstatic JsSpec
decimal
(Predicate<BigDecimal> predicate) non-nullable decimal number that satisfies the given predicatestatic JsSpec
instant()
non-nullable array specstatic JsSpec
non-nullable json object that satisfies the given predicatestatic JsSpec
integer()
non-nullable integer numberstatic JsSpec
integer
(IntPredicate predicate) non-nullable integer number that satisfies the given predicatestatic JsSpec
non-nullable long numberstatic JsSpec
longInteger
(LongPredicate predicate) non-nullable long number that satisfies the given predicatestatic JsSpec
returns a spec that validates that the JSON is an object and the value of each key is an arraystatic JsSpec
returns a spec that validates that the JSON is an object and the value of each key is a big integerstatic JsSpec
returns a spec that validates that the JSON is an object and the value of each key is a booleanstatic JsSpec
returns a spec that validates that the JSON is an object and the value of each key is a decimal numberstatic JsSpec
returns a spec that validates that the JSON is an object and the value of each key is an instantstatic JsSpec
returns a spec that validates that the JSON is an object and the value of each key is an integerstatic JsSpec
returns a spec that validates that the JSON is an object and the value of each key is a long numberstatic JsSpec
mapOfObj()
returns a spec that validates that the JSON is an object and the value of each key is an objectstatic JsSpec
mapOfStr()
returns a spec that validates that the JSON is an object and the value of each key is a stringstatic JsSpec
number()
non-nullable number specstatic JsSpec
non-nullable number that satisfies the given predicatestatic JsSpec
obj()
non-nullable json object specstatic JsSpec
non-nullable json object that satisfies the given predicatereturns an enum specstatic JsSpec
str()
non-nullable stringstatic JsSpec
str
(int min, int max) non-nullable string with the specified lengthstatic JsSpec
non-nullable string that satisfies the given predicatestatic JsSpec
non-nullable string with the specified patternstatic jsonvalues.spec.JsTupleSpec
returns a tuple spec.
-
Field Details
-
TRUE
true constant spec -
FALSE
false constant spec
-
-
Method Details
-
arrayOfNumber
non-nullable array of numbers spec- Returns:
- a spec
-
arrayOfDec
non-nullable array of decimal numbers spec- Returns:
- a spec
-
arrayOfBigInt
non-nullable array of integral numbers spec- Returns:
- a spec
-
arrayOfObj
non-nullable array of objects spec- Returns:
- a spec
-
arrayOfBool
non-nullable array of booleans spec- Returns:
- a spec
-
instant
non-nullable array spec- Returns:
- a spec
-
arrayOfLong
non-nullable array of long numbers spec- Returns:
- a spec
-
arrayOfInt
non-nullable array of integer numbers spec- Returns:
- a spec
-
arrayOfStr
non-nullable array of strings spec- Returns:
- a spec
-
binary
non-nullable array spec- Returns:
- a spec
-
bigInteger
non-nullable integral number- Returns:
- a spec
-
longInteger
non-nullable long number- Returns:
- a spec
-
bool
non-nullable boolean- Returns:
- a spec
-
decimal
non-nullable decimal number- Returns:
- a spec
-
integer
non-nullable integer number- Returns:
- a spec
-
obj
non-nullable json object spec- Returns:
- a spec
-
array
non-nullable array spec- Returns:
- a spec
-
any
spec that is conformed by any value- Returns:
- a spec
-
str
non-nullable string- Returns:
- a spec
-
str
non-nullable string with the specified length- Returns:
- a spec
-
str
non-nullable string with the specified pattern- Returns:
- a spec
-
number
non-nullable number spec- Returns:
- a spec
-
arrayOfInt
returns an array of integers spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfBigInt
returns an array of big integers spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfNumber
returns an array of numbers spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfObj
returns an array of objects spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfDec
returns an array of decimal numbers spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfBool
returns an array of boolean spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfStr
returns an array of strings spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfLong
returns an array of longs spec- Parameters:
minLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfObjSpec
A required and none nullable spec that specifies an array of objects that conform the given spec- Parameters:
spec
- the given spec that every object in the array has to conform- Returns:
- a spec
-
arrayOfObjSpec
A required and none nullable spec that specifies an array of objects that conform the given spec- Parameters:
spec
- the given spec that every object in the array has to conformminLength
- minimum length of the array (inclusive)maxLength
- maximum length of the array (inclusive)- Returns:
- a spec
-
cons
a required and non nullable spec that specifies a constant- Parameters:
value
- the constant- Returns:
- a spec
-
str
non-nullable string that satisfies the given predicate- Parameters:
predicate
- the predicate- Returns:
- a JsSpec
-
number
non-nullable number that satisfies the given predicate- Parameters:
predicate
- the predicate- Returns:
- a JsSpec
-
arrayOfIntSuchThat
non-nullable array of numbers that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfDec
non-nullable array of decimal numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each decimal number of the array is tested on- Returns:
- an array spec
-
arrayOfDec
non-nullable array of decimal numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each decimal number of the array is tested onminLength
- the minimum size of the array (inclusive)maxLength
- the maximum size of the array (inclusive)- Returns:
- an array spec
-
arrayOfDecSuchThat
non-nullable array of decimal numbers that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfBigInt
non-nullable array of integral numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each integral number of the array is tested on- Returns:
- an array spec
-
arrayOfBigInt
public static JsArraySpec arrayOfBigInt(Predicate<BigInteger> predicate, int minLength, int maxLength) non-nullable array of integral numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each integral number of the array is tested onminLength
- the minimum size of the array (inclusive)maxLength
- the maximum size of the array (inclusive)- Returns:
- an array spec
-
arrayOfBigIntSuchThat
non-nullable array of integral numbers that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfNumber
non-nullable array of numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each number of the array is tested on- Returns:
- an array spec
-
arrayOfNumber
public static JsArraySpec arrayOfNumber(Predicate<JsNumber> predicate, int minLength, int maxLength) non-nullable array of numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each number of the array is tested onminLength
- the minimum size of the array (inclusive)maxLength
- the maximum size of the array (inclusive)- Returns:
- an array spec
-
arrayOfNumberSuchThat
non-nullable array of numbers that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfObj
non-nullable array of objects, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each object of the array is tested on- Returns:
- an array spec
-
arrayOfObj
non-nullable array of objects, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each object of the array is tested onminLength
- the minimum size of the array (inclusive)maxLength
- the maximum size of the array (inclusive)- Returns:
- an array spec
-
arrayOfObjSuchThat
non-nullable array of objects that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
integer
non-nullable integer number that satisfies the given predicate- Parameters:
predicate
- the predicate the integer is tested on- Returns:
- a spec
-
arrayOfStrSuchThat
non-nullable array of strings that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
array
non-nullable array, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each value of the array is tested on- Returns:
- an array spec
-
arrayOfLong
non-nullable array of long numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each long number of the array is tested on- Returns:
- an array spec
-
arrayOfLong
non-nullable array of long numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each long number of the array is tested onminLength
- the minimum size of the array (inclusive)maxLength
- the maximum size of the array (inclusive)- Returns:
- an array spec
-
arrayOfBoolSuchThat
non-nullable array of booleans that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
longInteger
non-nullable long number that satisfies the given predicate- Parameters:
predicate
- the predicate the long is tested on- Returns:
- a spec
-
decimal
non-nullable decimal number that satisfies the given predicate- Parameters:
predicate
- the predicate the decimal is tested on- Returns:
- a spec
-
bigInteger
non-nullable integral number that satisfies the given predicate- Parameters:
predicate
- the predicate the integral number is tested on- Returns:
- a spec
-
arrayOfStr
non-nullable array of strings, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each string of the array is tested on- Returns:
- an array spec
-
arrayOfStr
non-nullable array of strings, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each string of the array is tested onminLength
- the minimum size of the array (inclusive)maxLength
- the maximum size of the array (inclusive)- Returns:
- an array spec
-
any
returns a spec that conforms any value that is evaluated to true on the predicate. When the type is not specified by the spec, positive numbers are parsed as Long by default, which has to be taken into account in order to define any condition.- Parameters:
predicate
- the predicate- Returns:
- a spec
-
binary
non-nullable json object that satisfies the given predicate- Parameters:
predicate
- the predicate the json object is tested on- Returns:
- a spec
-
instant
non-nullable json object that satisfies the given predicate- Parameters:
predicate
- the predicate the json object is tested on- Returns:
- a spec
-
obj
non-nullable json object that satisfies the given predicate- Parameters:
predicate
- the predicate the json object is tested on- Returns:
- a spec
-
arrayOfLongSuchThat
non-nullable array of long numbers that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
arraySuchThat
non-nullable array that satisfies the given predicate- Parameters:
predicate
- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfInt
non-nullable array of integer numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each integer number of the array is tested on- Returns:
- an array spec
-
arrayOfInt
non-nullable array of integer numbers, where each element of the array satisfies the given predicate- Parameters:
predicate
- the predicate each integer number of the array is tested onminLength
- the minimum size of the array (inclusive)maxLength
- the maximum size of the array (inclusive)- Returns:
- an array spec
-
tuple
returns a tuple spec. Each nth-element of the tuple is specified by the nth given spec- Parameters:
spec
- the spec of the first elementothers
- the rest of specs- Returns:
- a spec
-
oneOf
returns an enum spec- Type Parameters:
O
- the type of the possible values (subtype of JsValue)- Parameters:
cons
- the list of possible values- Returns:
- a spec
-
mapOfLong
returns a spec that validates that the JSON is an object and the value of each key is a long number- Returns:
- a spec
-
mapOfInteger
returns a spec that validates that the JSON is an object and the value of each key is an integer- Returns:
- a spec
-
mapOfBigInteger
returns a spec that validates that the JSON is an object and the value of each key is a big integer- Returns:
- a spec
-
mapOfDecimal
returns a spec that validates that the JSON is an object and the value of each key is a decimal number- Returns:
- a spec
-
mapOfBool
returns a spec that validates that the JSON is an object and the value of each key is a boolean- Returns:
- a spec
-
mapOfInstant
returns a spec that validates that the JSON is an object and the value of each key is an instant- Returns:
- a spec
-
mapOfObj
returns a spec that validates that the JSON is an object and the value of each key is an object- Returns:
- a spec
-
mapOfStr
returns a spec that validates that the JSON is an object and the value of each key is a string- Returns:
- a spec
-
mapOfArray
returns a spec that validates that the JSON is an object and the value of each key is an array- Returns:
- a spec
-