Package io.dialob.api.rest
Class ImmutableErrors.Error
java.lang.Object
io.dialob.api.rest.ImmutableErrors.Error
- All Implemented Interfaces:
Errors.Error,Serializable
- Enclosing class:
- ImmutableErrors
Immutable implementation of
Errors.Error.
Use the builder to create immutable instances:
ImmutableErrors.Error.builder().
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forError.static ImmutableErrors.ErrorcopyOf(Errors.Error instance) Creates an immutable copy of aErrors.Errorvalue.booleanThis instance is equal to all instances ofErrorthat have equal attribute values.getCode()getError()inthashCode()Computes a hash code from attributes:code,context,rejectedValue,error.toString()Prints the immutable valueErrorwith attribute values.final ImmutableErrors.ErrorCopy the current immutable object by setting a value for thecodeattribute.final ImmutableErrors.ErrorwithContext(String value) Copy the current immutable object by setting a value for thecontextattribute.final ImmutableErrors.ErrorCopy the current immutable object by setting a value for theerrorattribute.final ImmutableErrors.ErrorwithRejectedValue(Object value) Copy the current immutable object by setting a value for therejectedValueattribute.
-
Method Details
-
getCode
- Specified by:
getCodein interfaceErrors.Error- Returns:
- The value of the
codeattribute
-
getContext
- Specified by:
getContextin interfaceErrors.Error- Returns:
- The value of the
contextattribute
-
getRejectedValue
- Specified by:
getRejectedValuein interfaceErrors.Error- Returns:
- The value of the
rejectedValueattribute
-
getError
- Specified by:
getErrorin interfaceErrors.Error- Returns:
- The value of the
errorattribute
-
withCode
Copy the current immutable object by setting a value for thecodeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for code (can benull)- Returns:
- A modified copy of the
thisobject
-
withContext
Copy the current immutable object by setting a value for thecontextattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for context (can benull)- Returns:
- A modified copy of the
thisobject
-
withRejectedValue
Copy the current immutable object by setting a value for therejectedValueattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for rejectedValue (can benull)- Returns:
- A modified copy of the
thisobject
-
withError
Copy the current immutable object by setting a value for theerrorattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for error (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofErrorthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:code,context,rejectedValue,error. -
toString
Prints the immutable valueErrorwith attribute values. -
copyOf
Creates an immutable copy of aErrors.Errorvalue. 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
Creates a builder forError.ImmutableErrors.Error.builder() .code(String | null) // nullablecode.context(String | null) // nullablecontext.rejectedValue(Object | null) // nullablerejectedValue.error(String | null) // nullableerror.build();- Returns:
- A new Error builder
-