Introduce top-level pom file.
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / yangtools / binding / data / 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.yangtools.binding.data.codec.gen.spi;
9
10 import com.google.common.base.Preconditions;
11
12 /**
13  *
14  * Definition of static property for generated class
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         super();
31         this.name = Preconditions.checkNotNull(name);
32         this.type = Preconditions.checkNotNull(type);
33         this.value = Preconditions.checkNotNull(value);
34     }
35
36     public String getName() {
37         return name;
38     }
39
40     public Class<?> getType() {
41         return type;
42     }
43
44     public Object getValue() {
45         return value;
46     }
47
48     @Override
49     public int hashCode() {
50         final int prime = 31;
51         int result = 1;
52         result = prime * result + name.hashCode();
53         return result;
54     }
55
56     @Override
57     public boolean equals(final Object obj) {
58         if (this == obj) {
59             return true;
60         }
61         if (obj == null) {
62             return false;
63         }
64         if (getClass() != obj.getClass()) {
65             return false;
66         }
67         StaticConstantDefinition other = (StaticConstantDefinition) obj;
68         if (!name.equals(other.name)) {
69             return false;
70         }
71         return true;
72     }
73
74 }