BUG-50 : added test for PathKey Object.
[bgpcep.git] / programming / spi / src / main / java / org / opendaylight / bgpcep / programming / spi / SuccessfulRpcResult.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.bgpcep.programming.spi;
9
10 import java.util.Collection;
11 import java.util.Collections;
12
13 import org.opendaylight.yangtools.yang.common.RpcError;
14 import org.opendaylight.yangtools.yang.common.RpcResult;
15
16 public final class SuccessfulRpcResult<T> implements RpcResult<T> {
17         private final T value;
18
19         private SuccessfulRpcResult(final T value) {
20                 this.value = value;
21         }
22
23         public static <T> SuccessfulRpcResult<T> create(final T value) {
24                 return new SuccessfulRpcResult<T>(value);
25         }
26
27         @Override
28         public boolean isSuccessful() {
29                 return true;
30         }
31
32         @Override
33         public T getResult() {
34                 return value;
35         }
36
37         @Override
38         public Collection<RpcError> getErrors() {
39                 return Collections.emptyList();
40         }
41 }