Package io.inversion

Class Validation

java.lang.Object
io.inversion.Validation

public class Validation extends Object
Utility designed to make it easy to validate request properties or request body json values while you are retrieving them.
  • Constructor Details

  • Method Details

    • required

      public Validation required(String... childProps)
      If there are any childProps they must exist on the JSNode found at pathOrProp. If childProps are null/empty then pathOrProp must not be null.
      Parameters:
      childProps - the child properties to check for
      Returns:
      this
      Throws:
      ApiException - 400 if the referenced validation is null.
    • matches

      public Validation matches(Pattern regex)
    • matches

      public Validation matches(String regex)
    • in

      public Validation in(Object... possibleValues)
    • out

      public Validation out(Object... excludedValues)
    • compareTo

      protected int compareTo(Object compareTo)
    • gt

      public Validation gt(Object compareTo)
    • ge

      public Validation ge(Object compareTo)
    • lt

      public Validation lt(Object compareTo)
    • le

      public Validation le(Object compareTo)
    • eq

      public Validation eq(Object compareTo)
    • ne

      public Validation ne(Object compareTo)
    • length

      public Validation length(int max)
    • length

      public Validation length(int min, int max)
    • minMax

      public Validation minMax(Number min, Number max)
    • max

      public Validation max(Number max)
    • min

      public Validation min(Number min)
    • value

      public Object value()
    • asNode

      public io.inversion.json.JSNode asNode()
    • asArray

      public io.inversion.json.JSList asArray()
    • asString

      public String asString()
    • asInt

      public int asInt()
    • asDouble

      public double asDouble()
    • asBoolean

      public boolean asBoolean()
    • fail

      protected void fail(String defaultErrorMessage) throws ApiException
      Throws an ApiException 400 using customErrorMessage or defaultErrorMessage
      Parameters:
      defaultErrorMessage - the default error message
      Throws:
      ApiException - always