Class ImmutableErrors.Error

java.lang.Object
io.dialob.api.rest.ImmutableErrors.Error
All Implemented Interfaces:
Errors.Error, Serializable
Enclosing class:
ImmutableErrors

@Immutable public static final class ImmutableErrors.Error extends Object implements Errors.Error
Immutable implementation of Errors.Error.

Use the builder to create immutable instances: ImmutableErrors.Error.builder().

See Also:
  • Method Details

    • getCode

      public String getCode()
      Specified by:
      getCode in interface Errors.Error
      Returns:
      The value of the code attribute
    • getContext

      public String getContext()
      Specified by:
      getContext in interface Errors.Error
      Returns:
      The value of the context attribute
    • getRejectedValue

      public Object getRejectedValue()
      Specified by:
      getRejectedValue in interface Errors.Error
      Returns:
      The value of the rejectedValue attribute
    • getError

      public String getError()
      Specified by:
      getError in interface Errors.Error
      Returns:
      The value of the error attribute
    • withCode

      public final ImmutableErrors.Error withCode(String value)
      Copy the current immutable object by setting a value for the code attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for code (can be null)
      Returns:
      A modified copy of the this object
    • withContext

      public final ImmutableErrors.Error withContext(String value)
      Copy the current immutable object by setting a value for the context attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for context (can be null)
      Returns:
      A modified copy of the this object
    • withRejectedValue

      public final ImmutableErrors.Error withRejectedValue(Object value)
      Copy the current immutable object by setting a value for the rejectedValue attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for rejectedValue (can be null)
      Returns:
      A modified copy of the this object
    • withError

      public final ImmutableErrors.Error withError(String value)
      Copy the current immutable object by setting a value for the error attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for error (can be null)
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of Error that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: code, context, rejectedValue, error.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Error with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableErrors.Error copyOf(Errors.Error instance)
      Creates an immutable copy of a Errors.Error value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable Error instance
    • builder

      public static ImmutableErrors.Error.Builder builder()
      Creates a builder for Error.
       ImmutableErrors.Error.builder()
          .code(String | null) // nullable code
          .context(String | null) // nullable context
          .rejectedValue(Object | null) // nullable rejectedValue
          .error(String | null) // nullable error
          .build();
       
      Returns:
      A new Error builder