/* * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.sal.binding.api.rpc; import org.opendaylight.yangtools.concepts.Immutable; import org.opendaylight.yangtools.yang.binding.BaseIdentity; import org.opendaylight.yangtools.yang.binding.RpcService; @Deprecated public final class RpcContextIdentifier implements Immutable { public final Class rpcService; public final Class routingContext; private RpcContextIdentifier(Class rpcService, Class routingContext) { this.rpcService = rpcService; this.routingContext = routingContext; } public Class getRpcService() { return rpcService; } public Class getRoutingContext() { return routingContext; } public static RpcContextIdentifier contextForGlobalRpc(Class serviceType) { return new RpcContextIdentifier(serviceType, null); } public static RpcContextIdentifier contextFor(Class serviceType, Class routingContext) { return new RpcContextIdentifier(serviceType, routingContext); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (routingContext == null ? 0 : routingContext.hashCode()); result = prime * result + (rpcService == null ? 0 : rpcService.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RpcContextIdentifier other = (RpcContextIdentifier) obj; if (routingContext == null) { if (other.routingContext != null) { return false; } } else if (!routingContext.equals(other.routingContext)) { return false; } if (rpcService == null) { if (other.rpcService != null) { return false; } } else if (!rpcService.equals(other.rpcService)) { return false; } return true; } }