2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.binding.generator.util.generated.type.builder;
10 import org.opendaylight.controller.sal.binding.model.api.AccessModifier;
11 import org.opendaylight.controller.sal.binding.model.api.AnnotationType;
12 import org.opendaylight.controller.sal.binding.model.api.MethodSignature;
13 import org.opendaylight.controller.sal.binding.model.api.Type;
15 import java.util.Collections;
16 import java.util.List;
18 class MethodSignatureImpl extends AbstractTypeMember implements MethodSignature {
20 private final List<Parameter> params;
21 private final boolean isAbstract;
23 public MethodSignatureImpl(final Type definingType, final String name,
24 final List<AnnotationType> annotations,
25 final String comment, final AccessModifier accessModifier,
26 final Type returnType, final List<Parameter> params, boolean isFinal,
28 super(definingType, name, annotations, comment, accessModifier, returnType, isFinal);
29 this.params = Collections.unmodifiableList(params);
30 this.isAbstract = isAbstract;
34 public boolean isAbstract() {
39 public List<Parameter> getParameters() {
44 public int hashCode() {
47 result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
48 result = prime * result
49 + ((params == null) ? 0 : params.hashCode());
50 result = prime * result
51 + ((getReturnType() == null) ? 0 : getReturnType().hashCode());
56 public boolean equals(Object obj) {
63 if (getClass() != obj.getClass()) {
66 MethodSignatureImpl other = (MethodSignatureImpl) obj;
67 if (getName() == null) {
68 if (other.getName() != null) {
71 } else if (!getName().equals(other.getName())) {
75 if (other.params != null) {
78 } else if (!params.equals(other.params)) {
81 if (getReturnType() == null) {
82 if (other.getReturnType() != null) {
85 } else if (!getReturnType().equals(other.getReturnType())) {
92 public String toString() {
93 StringBuilder builder = new StringBuilder();
94 builder.append("MethodSignatureImpl [name=");
95 builder.append(getName());
96 builder.append(", comment=");
97 builder.append(getComment());
98 if (getDefiningType() != null) {
99 builder.append(", definingType=");
100 builder.append(getDefiningType().getPackageName());
102 builder.append(getDefiningType().getName());
104 builder.append(", definingType= null");
106 builder.append(", returnType=");
107 builder.append(getReturnType());
108 builder.append(", params=");
109 builder.append(params);
110 builder.append(", annotations=");
111 builder.append(getAnnotations());
113 return builder.toString();