Package org.projectnessie.error
Class ImmutableNessieError
- java.lang.Object
-
- org.projectnessie.error.ImmutableNessieError
-
- All Implemented Interfaces:
NessieError
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableNessieError extends Object implements NessieError
Immutable implementation ofNessieError.Use the builder to create immutable instances:
ImmutableNessieError.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableNessieError.BuilderBuilds instances of typeImmutableNessieError.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableNessieError.Builderbuilder()Creates a builder forImmutableNessieError.static ImmutableNessieErrorcopyOf(NessieError instance)Creates an immutable copy of aNessieErrorvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableNessieErrorthat have equal attribute values.ExceptiongetClientProcessingException()Client-sideExceptionrelated to the processing of the error response.ErrorCodegetErrorCode()Nessie-specific error code.StringgetMessage()Nessie-specific Error message.StringgetReason()Reason phrase for the HTTP status code.StringgetServerStackTrace()Server-side exception stack trace related to this error (if available).intgetStatus()HTTP status code of this error.inthashCode()Computes a hash code from attributes:status,reason,message,errorCode,serverStackTrace.StringtoString()Prints the immutable valueNessieErrorwith attribute values.ImmutableNessieErrorwithClientProcessingException(Exception value)Copy the current immutable object by setting a value for theclientProcessingExceptionattribute.ImmutableNessieErrorwithErrorCode(ErrorCode value)Copy the current immutable object by setting a value for theerrorCodeattribute.ImmutableNessieErrorwithMessage(String value)Copy the current immutable object by setting a value for themessageattribute.ImmutableNessieErrorwithReason(String value)Copy the current immutable object by setting a value for thereasonattribute.ImmutableNessieErrorwithServerStackTrace(String value)Copy the current immutable object by setting a value for theserverStackTraceattribute.ImmutableNessieErrorwithStatus(int value)Copy the current immutable object by setting a value for thestatusattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.projectnessie.error.NessieError
getFullMessage
-
-
-
-
Method Detail
-
getStatus
public int getStatus()
HTTP status code of this error.- Specified by:
getStatusin interfaceNessieError
-
getReason
public String getReason()
Reason phrase for the HTTP status code.- Specified by:
getReasonin interfaceNessieError
-
getMessage
public String getMessage()
Nessie-specific Error message.- Specified by:
getMessagein interfaceNessieError
-
getErrorCode
public ErrorCode getErrorCode()
Nessie-specific error code.- Specified by:
getErrorCodein interfaceNessieError
-
getServerStackTrace
@Nullable public String getServerStackTrace()
Server-side exception stack trace related to this error (if available).- Specified by:
getServerStackTracein interfaceNessieError
-
getClientProcessingException
@Nullable public Exception getClientProcessingException()
Client-sideExceptionrelated to the processing of the error response.This
Exceptiongenerally represents any errors related to the decoding of the payload returned by the server to describe the error.- Specified by:
getClientProcessingExceptionin interfaceNessieError
-
withStatus
public final ImmutableNessieError withStatus(int value)
Copy the current immutable object by setting a value for thestatusattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for status- Returns:
- A modified copy of the
thisobject
-
withReason
public final ImmutableNessieError withReason(String value)
Copy the current immutable object by setting a value for thereasonattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for reason- Returns:
- A modified copy of the
thisobject
-
withMessage
public final ImmutableNessieError withMessage(String value)
Copy the current immutable object by setting a value for themessageattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for message- Returns:
- A modified copy of the
thisobject
-
withErrorCode
public final ImmutableNessieError withErrorCode(ErrorCode value)
Copy the current immutable object by setting a value for theerrorCodeattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for errorCode- Returns:
- A modified copy of the
thisobject
-
withServerStackTrace
public final ImmutableNessieError withServerStackTrace(@Nullable String value)
Copy the current immutable object by setting a value for theserverStackTraceattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for serverStackTrace (can benull)- Returns:
- A modified copy of the
thisobject
-
withClientProcessingException
public final ImmutableNessieError withClientProcessingException(@Nullable Exception value)
Copy the current immutable object by setting a value for theclientProcessingExceptionattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for clientProcessingException (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableNessieErrorthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:status,reason,message,errorCode,serverStackTrace.
-
toString
public String toString()
Prints the immutable valueNessieErrorwith attribute values.
-
copyOf
public static ImmutableNessieError copyOf(NessieError instance)
Creates an immutable copy of aNessieErrorvalue. 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 NessieError instance
-
builder
public static ImmutableNessieError.Builder builder()
Creates a builder forImmutableNessieError.ImmutableNessieError.builder() .status(int) // requiredstatus.reason(String) // requiredreason.message(String) // optionalmessage.errorCode(org.projectnessie.error.ErrorCode) // optionalerrorCode.serverStackTrace(String | null) // nullableserverStackTrace.clientProcessingException(Exception | null) // nullableclientProcessingException.build();- Returns:
- A new ImmutableNessieError builder
-
-