2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.groupbasedpolicy.sxp.ep.provider.impl.util;
11 import org.apache.commons.net.util.SubnetUtils;
14 * Purpose: wraps {@link SubnetUtils.SubnetInfo} and overwrites hashcode and equals methods in order to
15 * be applicable as map key
18 public class SubnetInfoKeyDecorator {
20 private final SubnetUtils.SubnetInfo delegate;
22 public SubnetInfoKeyDecorator(final SubnetUtils.SubnetInfo delegate) {
23 this.delegate = delegate;
26 public SubnetUtils.SubnetInfo getDelegate() {
31 public boolean equals(final Object o) {
32 if (this == o) return true;
33 if (o == null || getClass() != o.getClass()) return false;
35 final SubnetInfoKeyDecorator that = (SubnetInfoKeyDecorator) o;
37 return delegate.getCidrSignature().equals(that.delegate.getCidrSignature());
42 public int hashCode() {
43 return delegate.getCidrSignature().hashCode();