1 package org.opendaylight.controller.sal.binding.api.rpc;
3 import org.opendaylight.yangtools.concepts.Immutable;
4 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
5 import org.opendaylight.yangtools.yang.binding.RpcService;
7 public final class RpcContextIdentifier implements Immutable{
9 public final Class<? extends RpcService> rpcService;
10 public final Class<? extends BaseIdentity> routingContext;
12 private RpcContextIdentifier(Class<? extends RpcService> rpcService, Class<? extends BaseIdentity> routingContext) {
14 this.rpcService = rpcService;
15 this.routingContext = routingContext;
18 public Class<? extends RpcService> getRpcService() {
22 public Class<? extends BaseIdentity> getRoutingContext() {
23 return routingContext;
26 public static final RpcContextIdentifier contextForGlobalRpc(Class<? extends RpcService> serviceType) {
27 return new RpcContextIdentifier(serviceType, null);
30 public static final RpcContextIdentifier contextFor(Class<? extends RpcService> serviceType,Class<? extends BaseIdentity> routingContext) {
31 return new RpcContextIdentifier(serviceType, routingContext);
35 public int hashCode() {
38 result = prime * result + ((routingContext == null) ? 0 : routingContext.hashCode());
39 result = prime * result + ((rpcService == null) ? 0 : rpcService.hashCode());
44 public boolean equals(Object obj) {
49 if (getClass() != obj.getClass())
51 RpcContextIdentifier other = (RpcContextIdentifier) obj;
52 if (routingContext == null) {
53 if (other.routingContext != null)
55 } else if (!routingContext.equals(other.routingContext))
57 if (rpcService == null) {
58 if (other.rpcService != null)
60 } else if (!rpcService.equals(other.rpcService))