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.mdsal.binding.model.util.generated.type.builder;
10 import java.util.List;
11 import java.util.Objects;
12 import org.opendaylight.mdsal.binding.model.api.AccessModifier;
13 import org.opendaylight.mdsal.binding.model.api.AnnotationType;
14 import org.opendaylight.mdsal.binding.model.api.MethodSignature;
15 import org.opendaylight.mdsal.binding.model.api.Type;
17 class MethodSignatureImpl extends AbstractTypeMember implements MethodSignature {
19 private final List<Parameter> params;
20 private final boolean isAbstract;
21 private final boolean isDefault;
23 MethodSignatureImpl(final Type definingType, final String name, final List<AnnotationType> annotations,
24 final String comment, final AccessModifier accessModifier, final Type returnType,
25 final List<Parameter> params, final boolean isFinal, final boolean isAbstract, final boolean isStatic) {
26 this(definingType, name, annotations, comment, accessModifier, returnType, params, isFinal, isAbstract,
30 MethodSignatureImpl(final Type definingType, final String name, final List<AnnotationType> annotations,
31 final String comment, final AccessModifier accessModifier, final Type returnType,
32 final List<Parameter> params, final boolean isFinal, final boolean isAbstract, final boolean isStatic,
33 final boolean isDefault) {
34 super(definingType, name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
36 this.isAbstract = isAbstract;
37 this.isDefault = isDefault;
41 public boolean isAbstract() {
42 return this.isAbstract;
46 public boolean isDefault() {
51 public List<Parameter> getParameters() {
56 public int hashCode() {
59 result = prime * result + Objects.hashCode(getName());
60 result = prime * result + Objects.hashCode(this.params);
61 result = prime * result + Objects.hashCode(getReturnType());
66 public boolean equals(final Object obj) {
73 if (getClass() != obj.getClass()) {
76 final MethodSignatureImpl other = (MethodSignatureImpl) obj;
77 if (!Objects.equals(getName(), other.getName())) {
80 if (!Objects.equals(this.params, other.params)) {
83 if (!Objects.equals(getReturnType(), other.getReturnType())) {
90 public String toString() {
91 final StringBuilder builder = new StringBuilder();
92 builder.append("MethodSignatureImpl [name=");
93 builder.append(getName());
94 builder.append(", comment=");
95 builder.append(getComment());
96 if (getDefiningType() != null) {
97 builder.append(", definingType=");
98 builder.append(getDefiningType().getPackageName());
100 builder.append(getDefiningType().getName());
102 builder.append(", definingType= null");
104 builder.append(", returnType=");
105 builder.append(getReturnType());
106 builder.append(", params=");
107 builder.append(this.params);
108 builder.append(", annotations=");
109 builder.append(getAnnotations());
111 return builder.toString();