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
8 package org.opendaylight.groupbasedpolicy.sxp.mapper.impl.util;
10 import org.apache.commons.net.util.SubnetUtils;
13 * Purpose: wraps {@link SubnetUtils.SubnetInfo} and overwrites hashcode and equals methods in order to
14 * be applicable as map key
17 public class SubnetInfoKeyDecorator {
19 private final SubnetUtils.SubnetInfo delegate;
21 public SubnetInfoKeyDecorator(final SubnetUtils.SubnetInfo delegate) {
22 this.delegate = delegate;
25 public SubnetUtils.SubnetInfo getDelegate() {
30 public boolean equals(final Object o) {
31 if (this == o) return true;
32 if (o == null || getClass() != o.getClass()) return false;
34 final SubnetInfoKeyDecorator that = (SubnetInfoKeyDecorator) o;
36 return delegate.getCidrSignature().equals(that.delegate.getCidrSignature());
41 public int hashCode() {
42 return delegate.getCidrSignature().hashCode();