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.yangtools.binding.generator.util.generated.type.builder;
10 import java.util.List;
12 import org.opendaylight.yangtools.sal.binding.model.api.AccessModifier;
13 import org.opendaylight.yangtools.sal.binding.model.api.AnnotationType;
14 import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature;
15 import org.opendaylight.yangtools.sal.binding.model.api.Type;
17 class MethodSignatureImpl extends AbstractTypeMember implements MethodSignature {
19 private final List<Parameter> params;
20 private final boolean isAbstract;
22 public MethodSignatureImpl(final Type definingType, final String name,
23 final List<AnnotationType> annotations,
24 final String comment, final AccessModifier accessModifier,
25 final Type returnType, final List<Parameter> params, final boolean isFinal,
26 final boolean isAbstract, final boolean isStatic) {
27 super(definingType, name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
29 this.isAbstract = isAbstract;
33 public boolean isAbstract() {
38 public List<Parameter> getParameters() {
43 public int hashCode() {
46 result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
47 result = prime * result
48 + ((params == null) ? 0 : params.hashCode());
49 result = prime * result
50 + ((getReturnType() == null) ? 0 : getReturnType().hashCode());
55 public boolean equals(final Object obj) {
62 if (getClass() != obj.getClass()) {
65 MethodSignatureImpl other = (MethodSignatureImpl) obj;
66 if (getName() == null) {
67 if (other.getName() != null) {
70 } else if (!getName().equals(other.getName())) {
74 if (other.params != null) {
77 } else if (!params.equals(other.params)) {
80 if (getReturnType() == null) {
81 if (other.getReturnType() != null) {
84 } else if (!getReturnType().equals(other.getReturnType())) {
91 public String toString() {
92 StringBuilder builder = new StringBuilder();
93 builder.append("MethodSignatureImpl [name=");
94 builder.append(getName());
95 builder.append(", comment=");
96 builder.append(getComment());
97 if (getDefiningType() != null) {
98 builder.append(", definingType=");
99 builder.append(getDefiningType().getPackageName());
101 builder.append(getDefiningType().getName());
103 builder.append(", definingType= null");
105 builder.append(", returnType=");
106 builder.append(getReturnType());
107 builder.append(", params=");
108 builder.append(params);
109 builder.append(", annotations=");
110 builder.append(getAnnotations());
112 return builder.toString();