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