Do no use Builder concept in RpcResultBuilder
[yangtools.git] / common / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / RpcResultBuilder.java
index 6b0cc3fb2d607f456ea55f225c78c8441b883c9f..3f87698bee8aad20aa9da26ecb3ad17604c163ae 100644 (file)
@@ -15,7 +15,7 @@ import com.google.common.util.concurrent.Futures;
 import java.io.Serializable;
 import java.util.Collection;
 import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.concepts.Mutable;
 
 /**
  * A builder for creating RpcResult instances.
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.concepts.Builder;
  *
  * @param <T> the result value type
  */
-public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
+public final class RpcResultBuilder<T> implements Mutable {
 
     private static class RpcResultImpl<T> implements RpcResult<T>, Serializable {
         private static final long serialVersionUID = 1L;
@@ -152,15 +152,6 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
         return new RpcResultBuilder<>(true, result);
     }
 
-    /**
-     * Returns a builder for a successful result.
-     *
-     * @param builder builder for the result value
-     */
-    public static <T> @NonNull RpcResultBuilder<T> success(final Builder<T> builder) {
-        return success(builder.build());
-    }
-
     /**
      * Returns a builder for a failed result.
      */
@@ -266,15 +257,6 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
         return this;
     }
 
-    /**
-     * Sets the value of the result.
-     *
-     * @param builder builder for the result value
-     */
-    public @NonNull RpcResultBuilder<T> withResult(final Builder<T> builder) {
-        return withResult(builder.build());
-    }
-
     private void addError(final ErrorSeverity severity, final ErrorType errorType, final ErrorTag tag,
             final String message, final String applicationTag, final String info, final Throwable cause) {
         addError(new RpcErrorImpl(severity, errorType, tag != null ? tag : ErrorTag.OPERATION_FAILED, message,
@@ -401,8 +383,12 @@ public final class RpcResultBuilder<T> implements Builder<RpcResult<T>> {
         return this;
     }
 
-    @Override
-    public RpcResult<T> build() {
+    /**
+     * Build the resulting {@link RpcResult}.
+     *
+     * @return An RpcResult instance
+     */
+    public @NonNull RpcResult<T> build() {
         return new RpcResultImpl<>(successful, result, errors != null ? errors.build() : ImmutableList.of());
     }