Class Validators


  • public class Validators
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Validators()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <I> λ<I,​I> validate​(Predicate<I> predicate, String errorMessage)
      returns a λ that validates the input against a predicate, returning the same input if the validations succeeds, or returning an error otherwise
      static λ<jsonvalues.JsArray,​jsonvalues.JsArray> validateJsArray​(jsonvalues.spec.JsArraySpec spec)
      returns a λ that validates the input json array, returning the same input if it conforms the given spec
      static λ<jsonvalues.JsObj,​jsonvalues.JsObj> validateJsObj​(jsonvalues.spec.JsObjSpec spec)
      returns a λ that validates the input json object, returning the same input if it conforms the given spec
    • Constructor Detail

      • Validators

        public Validators()
    • Method Detail

      • validateJsObj

        public static λ<jsonvalues.JsObj,​jsonvalues.JsObj> validateJsObj​(jsonvalues.spec.JsObjSpec spec)
        returns a λ that validates the input json object, returning the same input if it conforms the given spec
        Parameters:
        spec - the spec of the schema that has to conform the input
        Returns:
        a λ
      • validateJsArray

        public static λ<jsonvalues.JsArray,​jsonvalues.JsArray> validateJsArray​(jsonvalues.spec.JsArraySpec spec)
        returns a λ that validates the input json array, returning the same input if it conforms the given spec
        Parameters:
        spec - the spec of the schema that has to conform the input
        Returns:
        a λ
      • validate

        public static <I> λ<I,​I> validate​(Predicate<I> predicate,
                                                String errorMessage)
        returns a λ that validates the input against a predicate, returning the same input if the validations succeeds, or returning an error otherwise
        Type Parameters:
        I - the type of the input
        Parameters:
        predicate - the predicate on which the input will be tested on
        errorMessage - the message of the error returned
        Returns:
        a λ