import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
-
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
}
@Override
- public String toString(){
+ public String toString() {
return "RpcResult [successful=" + successful + ", result="
+ result + ", errors=" + errors + "]";
}
}
@Override
- public String getMessage(){
+ public String getMessage() {
return message;
}
}
@Override
- public String toString(){
+ public String toString() {
return "RpcError [message=" + message + ", severity="
+ severity + ", errorType=" + errorType + ", tag=" + tag
+ ", applicationTag=" + applicationTag + ", info=" + info
* Returns a builder for a successful result.
*/
public static <T> RpcResultBuilder<T> success() {
- return new RpcResultBuilder<T>( true, null );
+ return new RpcResultBuilder<>(true, null);
}
/**
* @param result the result value
*/
public static <T> RpcResultBuilder<T> success( final T result ) {
- return new RpcResultBuilder<T>( true, result );
+ return new RpcResultBuilder<>(true, result);
}
/**
* Returns a builder for a failed result.
*/
public static <T> RpcResultBuilder<T> failed() {
- return new RpcResultBuilder<T>( false, null );
+ return new RpcResultBuilder<>(false, null);
}
/**
* @param success true if successful, false otherwise.
*/
public static <T> RpcResultBuilder<T> status( final boolean success ) {
- return new RpcResultBuilder<T>( success, null );
+ return new RpcResultBuilder<>(success, null);
}
/**
* @param other the other RpcResult.
*/
public static <T> RpcResultBuilder<T> from( final RpcResult<T> other ) {
- return new RpcResultBuilder<T>( other.isSuccessful(), other.getResult() )
+ return new RpcResultBuilder<>(other.isSuccessful(), other.getResult())
.withRpcErrors( other.getErrors() );
}
private void addError( final RpcError error ) {
- if( errors == null ) {
- errors = new ImmutableList.Builder<RpcError>();
+ if (errors == null) {
+ errors = new ImmutableList.Builder<>();
}
errors.add( error );
* @param errors the list of RpcErrors
*/
public RpcResultBuilder<T> withRpcErrors( final Collection<RpcError> errors ) {
- if( errors != null ) {
- for( RpcError error: errors ) {
+ if (errors != null) {
+ for (RpcError error : errors) {
addError( error );
}
}
@Override
public RpcResult<T> build() {
- return new RpcResultImpl<T>( successful, result,
- errors != null ? errors.build() : Collections.<RpcError>emptyList() );
+ return new RpcResultImpl<>(successful, result,
+ errors != null ? errors.build() : Collections.emptyList());
}
/**