Code Review
/
mdsal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Override Rpc/Action invoke method
[mdsal.git]
/
binding
/
mdsal-binding-dom-adapter
/
src
/
main
/
java
/
org
/
opendaylight
/
mdsal
/
binding
/
dom
/
adapter
/
RpcAdapter.java
diff --git
a/binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/RpcAdapter.java
b/binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/RpcAdapter.java
index 624d8ffe9a9eb8b7fbc4ddce7bc17025b25dbba9..1903d3011652a9ad7ef42bc4d8efb4ff92de395d 100644
(file)
--- a/
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/RpcAdapter.java
+++ b/
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/RpcAdapter.java
@@
-26,7
+26,6
@@
final class RpcAdapter implements InvocationHandler {
private final @NonNull DOMRpcService delegate;
private final RpcInvocationStrategy strategy;
private final @NonNull Rpc<?, ?> facade;
private final @NonNull DOMRpcService delegate;
private final RpcInvocationStrategy strategy;
private final @NonNull Rpc<?, ?> facade;
- private final Method invokeMethod;
private final String name;
<T extends Rpc<?, ?>> RpcAdapter(final AdapterContext adapterContext, final DOMRpcService delegate,
private final String name;
<T extends Rpc<?, ?>> RpcAdapter(final AdapterContext adapterContext, final DOMRpcService delegate,
@@
-40,12
+39,6
@@
final class RpcAdapter implements InvocationHandler {
throw new IllegalStateException("Failed to find runtime type for " + type);
}
throw new IllegalStateException("Failed to find runtime type for " + type);
}
- try {
- invokeMethod = type.getMethod(Naming.RPC_INVOKE_NAME, RpcInput.class);
- } catch (NoSuchMethodException e) {
- throw new IllegalStateException("Failed to find invoke method in " + type, e);
- }
-
facade = type.cast(Proxy.newProxyInstance(type.getClassLoader(), new Class<?>[] { type }, this));
name = type.getName();
facade = type.cast(Proxy.newProxyInstance(type.getClassLoader(), new Class<?>[] { type }, this));
name = type.getName();
@@
-67,11
+60,12
@@
final class RpcAdapter implements InvocationHandler {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- if (invokeMethod.equals(method)) {
- return strategy.invoke((RpcInput) requireNonNull(args[0]));
- }
-
switch (method.getName()) {
switch (method.getName()) {
+ case Naming.RPC_INVOKE_NAME:
+ if (method.getParameterCount() == 1) {
+ return strategy.invoke((RpcInput) requireNonNull(args[0]));
+ }
+ break;
case "toString":
if (method.getReturnType().equals(String.class) && method.getParameterCount() == 0) {
return name + "$Adapter{delegate=" + delegate + "}";
case "toString":
if (method.getReturnType().equals(String.class) && method.getParameterCount() == 0) {
return name + "$Adapter{delegate=" + delegate + "}";