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;
11 import java.util.Objects;
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 + Objects.hashCode(getName());
47 result = prime * result + Objects.hashCode(params);
48 result = prime * result + Objects.hashCode(getReturnType());
53 public boolean equals(final Object obj) {
60 if (getClass() != obj.getClass()) {
63 MethodSignatureImpl other = (MethodSignatureImpl) obj;
64 if (!Objects.equals(getName(), other.getName())) {
67 if (!Objects.equals(params, other.params)) {
70 if (!Objects.equals(getReturnType(), other.getReturnType())) {
77 public String toString() {
78 StringBuilder builder = new StringBuilder();
79 builder.append("MethodSignatureImpl [name=");
80 builder.append(getName());
81 builder.append(", comment=");
82 builder.append(getComment());
83 if (getDefiningType() != null) {
84 builder.append(", definingType=");
85 builder.append(getDefiningType().getPackageName());
87 builder.append(getDefiningType().getName());
89 builder.append(", definingType= null");
91 builder.append(", returnType=");
92 builder.append(getReturnType());
93 builder.append(", params=");
94 builder.append(params);
95 builder.append(", annotations=");
96 builder.append(getAnnotations());
98 return builder.toString();