Pick up byte-buddy from yangtools
[mdsal.git] / binding / mdsal-binding-model-ri / src / main / java / org / opendaylight / mdsal / binding / model / ri / generated / type / builder / ConstantImpl.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 package org.opendaylight.mdsal.binding.model.ri.generated.type.builder;
9
10 import java.util.Objects;
11 import org.opendaylight.mdsal.binding.model.api.Constant;
12 import org.opendaylight.mdsal.binding.model.api.Type;
13
14 final class ConstantImpl implements Constant {
15     private final Type type;
16     private final String name;
17     private final Object value;
18
19     ConstantImpl(final Type type, final String name, final Object value) {
20         this.type = type;
21         this.name = name;
22         this.value = value;
23     }
24
25     @Override
26     public Type getType() {
27         return this.type;
28     }
29
30     @Override
31     public String getName() {
32         return this.name;
33     }
34
35     @Override
36     public Object getValue() {
37         return this.value;
38     }
39
40     @Override
41     public int hashCode() {
42         final int prime = 31;
43         int result = 1;
44         result = prime * result + Objects.hashCode(this.name);
45         result = prime * result + Objects.hashCode(this.type);
46         return result;
47     }
48
49     @Override
50     public boolean equals(final Object obj) {
51         if (this == obj) {
52             return true;
53         }
54         if (obj == null || getClass() != obj.getClass()) {
55             return false;
56         }
57         final ConstantImpl other = (ConstantImpl) obj;
58         return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type)
59                 && Objects.equals(this.value, other.value);
60     }
61
62     @Override
63     public String toString() {
64         final StringBuilder builder = new StringBuilder();
65         builder.append("Constant [type=");
66         builder.append(this.type);
67         builder.append(", name=");
68         builder.append(this.name);
69         builder.append(", value=");
70         builder.append(this.value);
71         builder.append("]");
72         return builder.toString();
73     }
74 }