3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.packet.address;
12 import java.io.Serializable;
14 import javax.xml.bind.annotation.XmlRootElement;
15 import javax.xml.bind.annotation.XmlSeeAlso;
17 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20 * @file DataLinkAddress.java
22 * @brief Abstract base class for a Datalink Address
27 * Abstract base class for a Datalink Address
31 @XmlSeeAlso( { EthernetAddress.class })
32 abstract public class DataLinkAddress implements Serializable {
33 private static final long serialVersionUID = 1L;
36 public DataLinkAddress() {
41 * Constructor of super class
43 * @param name Create a new DataLink, not for general use but
44 * available only for sub classes
46 * @return constructed object
48 protected DataLinkAddress(String name) {
53 * Used to copy the DataLinkAddress in a polymorphic way
56 * @return A clone of this DataLinkAddress
58 abstract public DataLinkAddress clone();
61 * Allow to distinguish among different data link addresses
64 * @return Name of the DataLinkAdress we are working on
66 public String getName() {
71 public int hashCode() {
74 result = prime * result + ((name == null) ? 0 : name.hashCode());
79 public boolean equals(Object obj) {
84 if (getClass() != obj.getClass())
86 DataLinkAddress other = (DataLinkAddress) obj;
88 if (other.name != null)
90 } else if (!name.equals(other.name))
96 public String toString() {
97 return "DataLinkAddress[" + ReflectionToStringBuilder.toString(this)