Revert "BUG-47 : unfinished PCEP migration to generated DTOs."
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / tlv / LSPSymbolicNameTlv.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.protocol.pcep.tlv;
10
11 import org.opendaylight.protocol.pcep.PCEPTlv;
12 import org.opendaylight.protocol.pcep.concepts.LSPSymbolicName;
13
14 /**
15  * Structure of LSP Symbolic Name Tlv.
16  * 
17  * @see <a
18  *      href="http://tools.ietf.org/html/draft-crabbe-pce-stateful-pce-02#section-7.2.1">The
19  *      LSP Symbolic Name TLV</a>
20  */
21 public class LSPSymbolicNameTlv implements PCEPTlv {
22         private static final long serialVersionUID = 2525226814028262452L;
23         private final LSPSymbolicName symbolicName;
24
25         /**
26          * Constructs new LSP Symbolic Name TLV.
27          * 
28          * @param symbolicName
29          *            LSPSymbolicName
30          */
31         public LSPSymbolicNameTlv(LSPSymbolicName symbolicName) {
32                 this.symbolicName = symbolicName;
33         }
34
35         /**
36          * Gets {@link LSPSymbolicName}.
37          * 
38          * @return LSPSymbolicName
39          */
40         public LSPSymbolicName getSymbolicName() {
41                 return this.symbolicName;
42         }
43
44         @Override
45         public int hashCode() {
46                 final int prime = 31;
47                 int result = 1;
48                 result = prime * result + ((this.symbolicName == null) ? 0 : this.symbolicName.hashCode());
49                 return result;
50         }
51
52         @Override
53         public boolean equals(Object obj) {
54                 if (this == obj)
55                         return true;
56                 if (obj == null)
57                         return false;
58                 if (this.getClass() != obj.getClass())
59                         return false;
60                 final LSPSymbolicNameTlv other = (LSPSymbolicNameTlv) obj;
61                 if (this.symbolicName == null) {
62                         if (other.symbolicName != null)
63                                 return false;
64                 } else if (!this.symbolicName.equals(other.symbolicName))
65                         return false;
66                 return true;
67         }
68
69         @Override
70         public String toString() {
71                 final StringBuilder builder = new StringBuilder();
72                 builder.append("LSPSymbolicNameTlv [symbolicName=");
73                 builder.append(this.symbolicName);
74                 builder.append("]");
75                 return builder.toString();
76         }
77
78 }