Refactored yang-maven-plugin. Updated tests.
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / packet / address / DataLinkAddress.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
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
8  */
9
10 package org.opendaylight.controller.sal.packet.address;
11
12 import java.io.Serializable;
13
14 import javax.xml.bind.annotation.XmlRootElement;
15 import javax.xml.bind.annotation.XmlSeeAlso;
16
17 import org.apache.commons.lang3.builder.HashCodeBuilder;
18 import org.apache.commons.lang3.builder.EqualsBuilder;
19 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20
21 /**
22  * @file   DataLinkAddress.java
23  *
24  * @brief  Abstract base class for a Datalink Address
25  *
26  */
27
28 /**
29  * Abstract base class for a Datalink Address
30  *
31  */
32 @XmlRootElement
33 @XmlSeeAlso( { EthernetAddress.class })
34 abstract public class DataLinkAddress implements Serializable {
35     private static final long serialVersionUID = 1L;
36     private String name;
37
38     public DataLinkAddress() {
39
40     }
41
42     /**
43      * Constructor of super class
44      *
45      * @param name Create a new DataLink, not for general use but
46      * available only for sub classes
47      *
48      * @return constructed object
49      */
50     protected DataLinkAddress(String name) {
51         this.name = name;
52     }
53
54     /**
55      * Used to copy the DataLinkAddress in a polymorphic way
56      *
57      *
58      * @return A clone of this DataLinkAddress
59      */
60     abstract public DataLinkAddress clone();
61
62     /**
63      * Allow to distinguish among different data link addresses
64      *
65      *
66      * @return Name of the DataLinkAdress we are working on
67      */
68     public String getName() {
69         return this.name;
70     }
71
72     @Override
73     public int hashCode() {
74         return HashCodeBuilder.reflectionHashCode(this);
75     }
76
77     @Override
78     public boolean equals(Object obj) {
79         return EqualsBuilder.reflectionEquals(this, obj);
80     }
81
82     @Override
83     public String toString() {
84         return "DataLinkAddress[" + ReflectionToStringBuilder.toString(this)
85                 + "]";
86     }
87 }