Use concepts.Builder in binding-generator-api
[mdsal.git] / binding / mdsal-binding-generator-util / src / main / java / org / opendaylight / mdsal / binding / model / util / generated / type / builder / MethodParameterImpl.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.util.generated.type.builder;
9
10 import java.util.Objects;
11 import org.opendaylight.mdsal.binding.model.api.MethodSignature.Parameter;
12 import org.opendaylight.mdsal.binding.model.api.Type;
13
14 final class MethodParameterImpl implements Parameter {
15
16     private final String name;
17     private final Type type;
18
19     public MethodParameterImpl(final String name, final Type type) {
20         this.name = name;
21         this.type = type;
22     }
23
24     @Override
25     public String getName() {
26         return this.name;
27     }
28
29     @Override
30     public Type getType() {
31         return this.type;
32     }
33
34     /*
35      * (non-Javadoc)
36      *
37      * @see java.lang.Object#hashCode()
38      */
39     @Override
40     public int hashCode() {
41         final int prime = 31;
42         int result = 1;
43         result = (prime * result) + Objects.hashCode(this.name);
44         result = (prime * result) + Objects.hashCode(this.type);
45         return result;
46     }
47
48     /*
49      * (non-Javadoc)
50      *
51      * @see java.lang.Object#equals(java.lang.Object)
52      */
53     @Override
54     public boolean equals(final Object obj) {
55         if (this == obj) {
56             return true;
57         }
58         if (obj == null) {
59             return false;
60         }
61         if (getClass() != obj.getClass()) {
62             return false;
63         }
64         final MethodParameterImpl other = (MethodParameterImpl) obj;
65         return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type);
66     }
67
68     /*
69      * (non-Javadoc)
70      *
71      * @see java.lang.Object#toString()
72      */
73     @Override
74     public String toString() {
75         final StringBuilder builder = new StringBuilder();
76         builder.append("MethodParameter [name=");
77         builder.append(this.name);
78         builder.append(", type=");
79         builder.append(this.type.getPackageName());
80         builder.append(".");
81         builder.append(this.type.getName());
82         builder.append("]");
83         return builder.toString();
84     }
85 }