Modifier and Type | Method and Description |
---|---|
RpcResult<T> |
build()
Returns instance of the product.
|
com.google.common.util.concurrent.ListenableFuture<RpcResult<T>> |
buildFuture()
Builds RpcResult and wraps it in a Future
This is a convenience method to assist those writing rpcs
that produce immediate results.
|
static <T> RpcResultBuilder<T> |
failed()
Returns a builder for a failed result.
|
static <T> RpcResultBuilder<T> |
from(RpcResult<T> other)
Returns a builder from another RpcResult.
|
static RpcError |
newError(RpcError.ErrorType errorType,
String tag,
String message)
Creates an RpcError with severity ERROR for reuse.
|
static RpcError |
newError(RpcError.ErrorType errorType,
String tag,
String message,
String applicationTag,
String info,
Throwable cause)
Creates an RpcError with severity ERROR for reuse.
|
static RpcError |
newWarning(RpcError.ErrorType errorType,
String tag,
String message)
Creates an RpcError with severity WARNING for reuse.
|
static RpcError |
newWarning(RpcError.ErrorType errorType,
String tag,
String message,
String applicationTag,
String info,
Throwable cause)
Creates an RpcError with severity WARNING for reuse.
|
static <T> RpcResultBuilder<T> |
status(boolean success)
Returns a builder based on the given status.
|
static <T> RpcResultBuilder<T> |
success()
Returns a builder for a successful result.
|
static <T> RpcResultBuilder<T> |
success(Builder<T> builder)
Returns a builder for a successful result.
|
static <T> RpcResultBuilder<T> |
success(T result)
Returns a builder for a successful result.
|
RpcResultBuilder<T> |
withError(RpcError.ErrorType errorType,
String message)
Adds an error to the result.
|
RpcResultBuilder<T> |
withError(RpcError.ErrorType errorType,
String tag,
String message)
Adds an error to the result.
|
RpcResultBuilder<T> |
withError(RpcError.ErrorType errorType,
String tag,
String message,
String applicationTag,
String info,
Throwable cause)
Adds an error to the result.
|
RpcResultBuilder<T> |
withError(RpcError.ErrorType errorType,
String message,
Throwable cause)
Adds an error to the result.
|
RpcResultBuilder<T> |
withResult(Builder<T> builder)
Sets the value of the result.
|
RpcResultBuilder<T> |
withResult(T result)
Sets the value of the result.
|
RpcResultBuilder<T> |
withRpcError(RpcError error)
Adds an RpcError.
|
RpcResultBuilder<T> |
withRpcErrors(Collection<RpcError> errors)
Adds RpcErrors.
|
RpcResultBuilder<T> |
withWarning(RpcError.ErrorType errorType,
String tag,
String message)
Adds a warning to the result.
|
RpcResultBuilder<T> |
withWarning(RpcError.ErrorType errorType,
String tag,
String message,
String applicationTag,
String info,
Throwable cause)
Adds a warning to the result.
|
public static <T> RpcResultBuilder<T> success()
public static <T> RpcResultBuilder<T> success(T result)
result
- the result valuepublic static <T> RpcResultBuilder<T> success(Builder<T> builder)
builder
- builder for the result valuepublic static <T> RpcResultBuilder<T> failed()
public static <T> RpcResultBuilder<T> status(boolean success)
success
- true if successful, false otherwise.public static <T> RpcResultBuilder<T> from(RpcResult<T> other)
other
- the other RpcResult.public static RpcError newError(RpcError.ErrorType errorType, String tag, String message)
errorType
- the conceptual layer at which the error occurred.tag
- a short string that identifies the general type of error condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the error condition.public static RpcError newError(RpcError.ErrorType errorType, String tag, String message, String applicationTag, String info, Throwable cause)
errorType
- the conceptual layer at which the error occurred.tag
- a short string that identifies the general type of error condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the error condition.
* @param applicationTag a short string that identifies the specific type of error condition.info
- a string containing additional information to provide extended
and/or implementation-specific debugging information.cause
- the exception that triggered the error.public static RpcError newWarning(RpcError.ErrorType errorType, String tag, String message)
errorType
- the conceptual layer at which the warning occurred.tag
- a short string that identifies the general type of warning condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the warning condition.public static RpcError newWarning(RpcError.ErrorType errorType, String tag, String message, String applicationTag, String info, Throwable cause)
errorType
- the conceptual layer at which the warning occurred.tag
- a short string that identifies the general type of warning condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the warning condition.
* @param applicationTag a short string that identifies the specific type of warning condition.info
- a string containing additional information to provide extended
and/or implementation-specific debugging information.cause
- the exception that triggered the warning.public RpcResultBuilder<T> withResult(T result)
result
- the result valuepublic RpcResultBuilder<T> withResult(Builder<T> builder)
builder
- builder for the result valuepublic RpcResultBuilder<T> withWarning(RpcError.ErrorType errorType, String tag, String message)
errorType
- the conceptual layer at which the warning occurred.tag
- a short string that identifies the general type of warning condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the warning condition.public RpcResultBuilder<T> withWarning(RpcError.ErrorType errorType, String tag, String message, String applicationTag, String info, Throwable cause)
errorType
- the conceptual layer at which the warning occurred.tag
- a short string that identifies the general type of warning condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the warning condition.applicationTag
- a short string that identifies the specific type of warning condition.info
- a string containing additional information to provide extended
and/or implementation-specific debugging information.cause
- the exception that triggered the warning.public RpcResultBuilder<T> withError(RpcError.ErrorType errorType, String message)
errorType
- the conceptual layer at which the error occurred.message
- a string suitable for human display that describes the error condition.public RpcResultBuilder<T> withError(RpcError.ErrorType errorType, String tag, String message)
errorType
- the conceptual layer at which the error occurred.tag
- a short string that identifies the general type of error condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the error condition.public RpcResultBuilder<T> withError(RpcError.ErrorType errorType, String message, Throwable cause)
errorType
- the conceptual layer at which the error occurred.message
- a string suitable for human display that describes the error condition.cause
- the exception that triggered the error.public RpcResultBuilder<T> withError(RpcError.ErrorType errorType, String tag, String message, String applicationTag, String info, Throwable cause)
errorType
- the conceptual layer at which the error occurred.tag
- a short string that identifies the general type of error condition. See
RpcError.getTag()
for a list of suggested values.message
- a string suitable for human display that describes the error condition.applicationTag
- a short string that identifies the specific type of error condition.info
- a string containing additional information to provide extended
and/or implementation-specific debugging information.cause
- the exception that triggered the error.public RpcResultBuilder<T> withRpcError(RpcError error)
error
- the RpcErrorpublic RpcResultBuilder<T> withRpcErrors(Collection<RpcError> errors)
errors
- the list of RpcErrorspublic RpcResult<T> build()
Builder
public com.google.common.util.concurrent.ListenableFuture<RpcResult<T>> buildFuture()
Copyright © 2018 OpenDaylight. All rights reserved.