Interface InvalidFieldError

All Superinterfaces:
ErrorObject

public interface InvalidFieldError extends ErrorObject

Returned when a field has an invalid value.


Example to create an instance using the builder pattern

     InvalidFieldError invalidFieldError = InvalidFieldError.builder()
             .message("{message}")
             .field("{field}")
             .build()
 
  • Field Details

  • Method Details

    • getCode

      @NotNull @NotNull String getCode()
      Description copied from interface: ErrorObject

      Error identifier.

      Specified by:
      getCode in interface ErrorObject
      Returns:
      code
    • getMessage

      @NotNull @NotNull String getMessage()

      "The value $invalidValue is not valid for field $field."

      Specified by:
      getMessage in interface ErrorObject
      Returns:
      message
    • getField

      @NotNull @NotNull String getField()

      Name of the field with the invalid value.

      Returns:
      field
    • getInvalidValue

      @NotNull @NotNull Object getInvalidValue()

      Value invalid for the field.

      Returns:
      invalidValue
    • getAllowedValues

      List<Object> getAllowedValues()

      Fixed set of allowed values for the field, if any.

      Returns:
      allowedValues
    • setMessage

      void setMessage(String message)

      "The value $invalidValue is not valid for field $field."

      Specified by:
      setMessage in interface ErrorObject
      Parameters:
      message - value to be set
    • setField

      void setField(String field)

      Name of the field with the invalid value.

      Parameters:
      field - value to be set
    • setInvalidValue

      void setInvalidValue(Object invalidValue)

      Value invalid for the field.

      Parameters:
      invalidValue - value to be set
    • setAllowedValues

      void setAllowedValues(Object... allowedValues)

      Fixed set of allowed values for the field, if any.

      Parameters:
      allowedValues - values to be set
    • setAllowedValues

      void setAllowedValues(List<Object> allowedValues)

      Fixed set of allowed values for the field, if any.

      Parameters:
      allowedValues - values to be set
    • of

      static InvalidFieldError of()
      factory method
      Returns:
      instance of InvalidFieldError
    • of

      static InvalidFieldError of(InvalidFieldError template)
      factory method to create a shallow copy InvalidFieldError
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      factory method to create a deep copy of InvalidFieldError
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static InvalidFieldErrorBuilder builder()
      builder factory method for InvalidFieldError
      Returns:
      builder
    • builder

      static InvalidFieldErrorBuilder builder(InvalidFieldError template)
      create builder for InvalidFieldError instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withInvalidFieldError

      default <T> T withInvalidFieldError(Function<InvalidFieldError,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<InvalidFieldError> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference