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 public static final class ImmutableErrors.Error extends Object implements Errors.Error
Immutable implementation ofErrors.Error.Use the builder to create immutable instances:
ImmutableErrors.Error.builder().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableErrors.Error.BuilderBuilds instances of typeError.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableErrors.Error.Builderbuilder()Creates a builder forError.static ImmutableErrors.ErrorcopyOf(Errors.Error instance)Creates an immutable copy of aErrors.Errorvalue.booleanequals(Object another)This instance is equal to all instances ofErrorthat have equal attribute values.StringgetCode()StringgetContext()StringgetError()ObjectgetRejectedValue()inthashCode()Computes a hash code from attributes:code,context,rejectedValue,error.StringtoString()Prints the immutable valueErrorwith attribute values.ImmutableErrors.ErrorwithCode(String value)Copy the current immutable object by setting a value for thecodeattribute.ImmutableErrors.ErrorwithContext(String value)Copy the current immutable object by setting a value for thecontextattribute.ImmutableErrors.ErrorwithError(String value)Copy the current immutable object by setting a value for theerrorattribute.ImmutableErrors.ErrorwithRejectedValue(Object value)Copy the current immutable object by setting a value for therejectedValueattribute.
-
-
-
Method Detail
-
getCode
public String getCode()
- Specified by:
getCodein interfaceErrors.Error- Returns:
- The value of the
codeattribute
-
getContext
public String getContext()
- Specified by:
getContextin interfaceErrors.Error- Returns:
- The value of the
contextattribute
-
getRejectedValue
public Object getRejectedValue()
- Specified by:
getRejectedValuein interfaceErrors.Error- Returns:
- The value of the
rejectedValueattribute
-
getError
public String getError()
- Specified by:
getErrorin interfaceErrors.Error- Returns:
- The value of the
errorattribute
-
withCode
public final ImmutableErrors.Error withCode(String value)
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
public final ImmutableErrors.Error withContext(String value)
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
public final ImmutableErrors.Error withRejectedValue(Object value)
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
public final ImmutableErrors.Error withError(String value)
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
public boolean equals(@Nullable Object another)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
public String toString()
Prints the immutable valueErrorwith attribute values.
-
copyOf
public static ImmutableErrors.Error copyOf(Errors.Error instance)
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
public static ImmutableErrors.Error.Builder 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
-
-