Fix checkstyle in mdsal-binding-dom-codec
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / gen / spi / StaticConstantDefinition.java
1 /*
2  * Copyright (c) 2014 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.dom.codec.gen.spi;
9
10 import com.google.common.base.Preconditions;
11
12 /**
13  * Definition of static property for generated class.
14  *
15  * <p>
16  * This definition consists of
17  * <ul>
18  * <li>name - property name</li>
19  * <li>type - Java type for property</li>
20  * <li>value - value to which property should be initialized</li>
21  * </ul>
22  */
23 public class StaticConstantDefinition {
24
25     private final String name;
26     private final Class<?> type;
27     private final Object value;
28
29     public StaticConstantDefinition(final String name, final Class<?> type, final Object value) {
30         this.name = Preconditions.checkNotNull(name);
31         this.type = Preconditions.checkNotNull(type);
32         this.value = Preconditions.checkNotNull(value);
33     }
34
35     public String getName() {
36         return name;
37     }
38
39     public Class<?> getType() {
40         return type;
41     }
42
43     public Object getValue() {
44         return value;
45     }
46
47     @Override
48     public int hashCode() {
49         final int prime = 31;
50         int result = 1;
51         result = prime * result + name.hashCode();
52         return result;
53     }
54
55     @Override
56     public boolean equals(final Object obj) {
57         if (this == obj) {
58             return true;
59         }
60         if (obj == null) {
61             return false;
62         }
63         if (getClass() != obj.getClass()) {
64             return false;
65         }
66         StaticConstantDefinition other = (StaticConstantDefinition) obj;
67         if (!name.equals(other.name)) {
68             return false;
69         }
70         return true;
71     }
72 }