Package jsonvalues.spec
Class JsSpecs
- java.lang.Object
-
- jsonvalues.spec.JsSpecs
-
public final class JsSpecs extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JsSpecany()spec that is conformed by any valuestatic JsSpecany(Predicate<JsValue> predicate)returns a spec that conforms any value that is evaluated to true on the predicate.static JsArraySpecarray()non-nullable array specstatic JsArraySpecarray(Predicate<JsValue> predicate)non-nullable array, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfBigInt()non-nullable array of integral numbers specstatic JsArraySpecarrayOfBigInt(int minLength, int maxLength)static JsArraySpecarrayOfBigInt(Predicate<BigInteger> predicate)non-nullable array of integral numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfBigInt(Predicate<BigInteger> predicate, int minLength, int maxLength)non-nullable array of integral numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfBigIntSuchThat(Predicate<JsArray> predicate)non-nullable array of integral numbers that satisfies the given predicatestatic JsArraySpecarrayOfBool()non-nullable array of booleans specstatic JsArraySpecarrayOfBool(int minLength, int maxLength)static JsArraySpecarrayOfBoolSuchThat(Predicate<JsArray> predicate)non-nullable array of booleans that satisfies the given predicatestatic JsArraySpecarrayOfDec()non-nullable array of decimal numbers specstatic JsArraySpecarrayOfDec(int minLength, int maxLength)static JsArraySpecarrayOfDec(Predicate<BigDecimal> predicate)non-nullable array of decimal numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfDec(Predicate<BigDecimal> predicate, int minLength, int maxLength)non-nullable array of decimal numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfDecSuchThat(Predicate<JsArray> predicate)non-nullable array of decimal numbers that satisfies the given predicatestatic JsArraySpecarrayOfInt()non-nullable array of integer numbers specstatic JsArraySpecarrayOfInt(int minLength, int maxLength)static JsArraySpecarrayOfInt(IntPredicate predicate)non-nullable array of integer numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfInt(IntPredicate predicate, int minLength, int maxLength)non-nullable array of integer numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfIntSuchThat(Predicate<JsArray> predicate)non-nullable array of numbers that satisfies the given predicatestatic JsArraySpecarrayOfLong()non-nullable array of long numbers specstatic JsArraySpecarrayOfLong(int minLength, int maxLength)static JsArraySpecarrayOfLong(LongPredicate predicate)non-nullable array of long numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfLong(LongPredicate predicate, int minLength, int maxLength)non-nullable array of long numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfLongSuchThat(Predicate<JsArray> predicate)non-nullable array of long numbers that satisfies the given predicatestatic JsArraySpecarrayOfNumber()non-nullable array of numbers specstatic JsArraySpecarrayOfNumber(int minLength, int maxLength)static JsArraySpecarrayOfNumber(Predicate<JsNumber> predicate)non-nullable array of numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfNumber(Predicate<JsNumber> predicate, int minLength, int maxLength)non-nullable array of numbers, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfNumberSuchThat(Predicate<JsArray> predicate)non-nullable array of numbers that satisfies the given predicatestatic JsArraySpecarrayOfObj()non-nullable array of objects specstatic JsArraySpecarrayOfObj(int minLength, int maxLength)static JsArraySpecarrayOfObj(Predicate<JsObj> predicate)non-nullable array of objects, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfObj(Predicate<JsObj> predicate, int minLength, int maxLength)non-nullable array of objects, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfObjSpec(JsObjSpec spec)A required and none nullable spec that specifies an array of objects that conform the given specstatic JsArraySpecarrayOfObjSpec(JsObjSpec spec, int minLength, int maxLength)A required and none nullable spec that specifies an array of objects that conform the given specstatic JsArraySpecarrayOfObjSuchThat(Predicate<JsArray> predicate)non-nullable array of objects that satisfies the given predicatestatic JsArraySpecarrayOfStr()non-nullable array of strings specstatic JsArraySpecarrayOfStr(int minLength, int maxLength)static JsArraySpecarrayOfStr(Predicate<String> predicate)non-nullable array of strings, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfStr(Predicate<String> predicate, int minLength, int maxLength)non-nullable array of strings, where each element of the array satisfies the given predicatestatic JsArraySpecarrayOfStrSuchThat(Predicate<JsArray> predicate)non-nullable array of strings that satisfies the given predicatestatic JsArraySpecarraySuchThat(Predicate<JsArray> predicate)non-nullable array that satisfies the given predicatestatic JsSpecbigInteger()non-nullable integral numberstatic JsSpecbigInteger(Predicate<BigInteger> predicate)non-nullable integral number that satisfies the given predicatestatic JsSpecbinary()non-nullable array specstatic JsSpecbinary(Predicate<byte[]> predicate)non-nullable json object that satisfies the given predicatestatic JsSpecbool()non-nullable booleanstatic JsSpeccons(JsValue value)a required and non nullable spec that specifies a constantstatic JsSpecdecimal()non-nullable decimal numberstatic JsSpecdecimal(Predicate<BigDecimal> predicate)non-nullable decimal number that satisfies the given predicatestatic JsSpecinstant()non-nullable array specstatic JsSpecinstant(Predicate<Instant> predicate)non-nullable json object that satisfies the given predicatestatic JsSpecinteger()non-nullable integer numberstatic JsSpecinteger(IntPredicate predicate)non-nullable integer number that satisfies the given predicatestatic JsSpeclongInteger()non-nullable long numberstatic JsSpeclongInteger(LongPredicate predicate)non-nullable long number that satisfies the given predicatestatic JsSpecnumber()non-nullable numberstatic JsSpecnumber(Predicate<JsNumber> predicate)non-nullable number that satisfies the given predicatestatic JsSpecobj()non-nullable json object specstatic JsSpecobj(Predicate<JsObj> predicate)non-nullable json object that satisfies the given predicatestatic <O extends JsValue>
JsSpeconeOf(List<O> cons)returns an enum specstatic JsSpecstr()non-nullable stringstatic JsSpecstr(Predicate<String> predicate)non-nullable string that satisfies the given predicatestatic JsTupleSpectuple(JsSpec spec, JsSpec... others)returns a tuple spec.
-
-
-
Method Detail
-
arrayOfNumber
public static JsArraySpec arrayOfNumber()
non-nullable array of numbers spec- Returns:
- a spec
-
arrayOfDec
public static JsArraySpec arrayOfDec()
non-nullable array of decimal numbers spec- Returns:
- a spec
-
arrayOfBigInt
public static JsArraySpec arrayOfBigInt()
non-nullable array of integral numbers spec- Returns:
- a spec
-
arrayOfObj
public static JsArraySpec arrayOfObj()
non-nullable array of objects spec- Returns:
- a spec
-
arrayOfBool
public static JsArraySpec arrayOfBool()
non-nullable array of booleans spec- Returns:
- a spec
-
instant
public static JsSpec instant()
non-nullable array spec- Returns:
- a spec
-
arrayOfLong
public static JsArraySpec arrayOfLong()
non-nullable array of long numbers spec- Returns:
- a spec
-
arrayOfInt
public static JsArraySpec arrayOfInt()
non-nullable array of integer numbers spec- Returns:
- a spec
-
arrayOfStr
public static JsArraySpec arrayOfStr()
non-nullable array of strings spec- Returns:
- a spec
-
binary
public static JsSpec binary()
non-nullable array spec- Returns:
- a spec
-
bigInteger
public static JsSpec bigInteger()
non-nullable integral number- Returns:
- a spec
-
longInteger
public static JsSpec longInteger()
non-nullable long number- Returns:
- a spec
-
bool
public static JsSpec bool()
non-nullable boolean- Returns:
- a spec
-
decimal
public static JsSpec decimal()
non-nullable decimal number- Returns:
- a spec
-
integer
public static JsSpec integer()
non-nullable integer number- Returns:
- a spec
-
obj
public static JsSpec obj()
non-nullable json object spec- Returns:
- a spec
-
array
public static JsArraySpec array()
non-nullable array spec- Returns:
- a spec
-
any
public static JsSpec any()
spec that is conformed by any value- Returns:
- a spec
-
str
public static JsSpec str()
non-nullable string- Returns:
- a spec
-
number
public static JsSpec number()
non-nullable number- Returns:
- a spec
-
arrayOfInt
public static JsArraySpec arrayOfInt(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfBigInt
public static JsArraySpec arrayOfBigInt(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfNumber
public static JsArraySpec arrayOfNumber(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfObj
public static JsArraySpec arrayOfObj(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfDec
public static JsArraySpec arrayOfDec(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfBool
public static JsArraySpec arrayOfBool(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfStr
public static JsArraySpec arrayOfStr(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfLong
public static JsArraySpec arrayOfLong(int minLength, int maxLength)
- Parameters:
minLength- minimum length of the array (inclusive)maxLength- maximum length of the array (inclusive)- Returns:
- a spec
-
arrayOfObjSpec
public static JsArraySpec arrayOfObjSpec(JsObjSpec spec)
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
public static JsArraySpec arrayOfObjSpec(JsObjSpec spec, int minLength, int maxLength)
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
public static JsSpec cons(JsValue value)
a required and non nullable spec that specifies a constant- Parameters:
value- the constant- Returns:
- a spec
-
str
public static JsSpec str(Predicate<String> predicate)
non-nullable string that satisfies the given predicate- Parameters:
predicate- the predicate- Returns:
- a JsSpec
-
number
public static JsSpec number(Predicate<JsNumber> predicate)
non-nullable number that satisfies the given predicate- Parameters:
predicate- the predicate- Returns:
- a JsSpec
-
arrayOfIntSuchThat
public static JsArraySpec arrayOfIntSuchThat(Predicate<JsArray> predicate)
non-nullable array of numbers that satisfies the given predicate- Parameters:
predicate- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfDec
public static JsArraySpec arrayOfDec(Predicate<BigDecimal> predicate)
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
public static JsArraySpec arrayOfDec(Predicate<BigDecimal> predicate, int minLength, int maxLength)
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
public static JsArraySpec arrayOfDecSuchThat(Predicate<JsArray> predicate)
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
public static JsArraySpec arrayOfBigInt(Predicate<BigInteger> predicate)
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
public static JsArraySpec arrayOfBigIntSuchThat(Predicate<JsArray> predicate)
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
public static JsArraySpec arrayOfNumber(Predicate<JsNumber> predicate)
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
public static JsArraySpec arrayOfNumberSuchThat(Predicate<JsArray> predicate)
non-nullable array of numbers that satisfies the given predicate- Parameters:
predicate- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfObj
public static JsArraySpec arrayOfObj(Predicate<JsObj> predicate)
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
public static JsArraySpec arrayOfObj(Predicate<JsObj> predicate, int minLength, int maxLength)
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
public static JsArraySpec arrayOfObjSuchThat(Predicate<JsArray> predicate)
non-nullable array of objects that satisfies the given predicate- Parameters:
predicate- the predicate the array is tested on- Returns:
- an array spec
-
integer
public static JsSpec integer(IntPredicate predicate)
non-nullable integer number that satisfies the given predicate- Parameters:
predicate- the predicate the integer is tested on- Returns:
- a spec
-
arrayOfStrSuchThat
public static JsArraySpec arrayOfStrSuchThat(Predicate<JsArray> predicate)
non-nullable array of strings that satisfies the given predicate- Parameters:
predicate- the predicate the array is tested on- Returns:
- an array spec
-
array
public static JsArraySpec array(Predicate<JsValue> predicate)
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
public static JsArraySpec arrayOfLong(LongPredicate predicate)
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
public static JsArraySpec arrayOfLong(LongPredicate predicate, int minLength, int maxLength)
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
public static JsArraySpec arrayOfBoolSuchThat(Predicate<JsArray> predicate)
non-nullable array of booleans that satisfies the given predicate- Parameters:
predicate- the predicate the array is tested on- Returns:
- an array spec
-
longInteger
public static JsSpec longInteger(LongPredicate predicate)
non-nullable long number that satisfies the given predicate- Parameters:
predicate- the predicate the long is tested on- Returns:
- a spec
-
decimal
public static JsSpec decimal(Predicate<BigDecimal> predicate)
non-nullable decimal number that satisfies the given predicate- Parameters:
predicate- the predicate the decimal is tested on- Returns:
- a spec
-
bigInteger
public static JsSpec bigInteger(Predicate<BigInteger> predicate)
non-nullable integral number that satisfies the given predicate- Parameters:
predicate- the predicate the integral number is tested on- Returns:
- a spec
-
arrayOfStr
public static JsArraySpec arrayOfStr(Predicate<String> predicate)
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
public static JsArraySpec arrayOfStr(Predicate<String> predicate, int minLength, int maxLength)
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
public static JsSpec any(Predicate<JsValue> predicate)
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
public static JsSpec binary(Predicate<byte[]> predicate)
non-nullable json object that satisfies the given predicate- Parameters:
predicate- the predicate the json object is tested on- Returns:
- a spec
-
instant
public static JsSpec instant(Predicate<Instant> predicate)
non-nullable json object that satisfies the given predicate- Parameters:
predicate- the predicate the json object is tested on- Returns:
- a spec
-
obj
public static JsSpec obj(Predicate<JsObj> predicate)
non-nullable json object that satisfies the given predicate- Parameters:
predicate- the predicate the json object is tested on- Returns:
- a spec
-
arrayOfLongSuchThat
public static JsArraySpec arrayOfLongSuchThat(Predicate<JsArray> predicate)
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
public static JsArraySpec arraySuchThat(Predicate<JsArray> predicate)
non-nullable array that satisfies the given predicate- Parameters:
predicate- the predicate the array is tested on- Returns:
- an array spec
-
arrayOfInt
public static JsArraySpec arrayOfInt(IntPredicate predicate)
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
public static JsArraySpec arrayOfInt(IntPredicate predicate, int minLength, int maxLength)
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
public static JsTupleSpec tuple(JsSpec spec, JsSpec... others)
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
-
-