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 {
18 private final List<Parameter> params;
19 private final boolean isAbstract;
20 private final boolean isDefault;
22 MethodSignatureImpl(final Type definingType, final String name, final List<AnnotationType> annotations,
23 final String comment, final AccessModifier accessModifier, final Type returnType,
24 final List<Parameter> params, final boolean isFinal, final boolean isAbstract, final boolean isStatic) {
25 this(definingType, name, annotations, comment, accessModifier, returnType, params, isFinal, isAbstract,
29 MethodSignatureImpl(final Type definingType, final String name, final List<AnnotationType> annotations,
30 final String comment, final AccessModifier accessModifier, final Type returnType,
31 final List<Parameter> params, final boolean isFinal, final boolean isAbstract, final boolean isStatic,
32 final boolean isDefault) {
33 super(definingType, name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
35 this.isAbstract = isAbstract;
36 this.isDefault = isDefault;
40 public boolean isAbstract() {
41 return this.isAbstract;
45 public boolean isDefault() {
50 public List<Parameter> getParameters() {
55 public int hashCode() {
58 result = prime * result + Objects.hashCode(getName());
59 result = prime * result + Objects.hashCode(this.params);
60 result = prime * result + Objects.hashCode(getReturnType());
65 public boolean equals(final Object obj) {
69 if (obj == null || getClass() != obj.getClass()) {
72 final MethodSignatureImpl other = (MethodSignatureImpl) obj;
73 return Objects.equals(getName(), other.getName())
74 && Objects.equals(this.params, other.params)
75 && Objects.equals(getReturnType(), other.getReturnType());
79 public String toString() {
80 final StringBuilder builder = new StringBuilder().append("MethodSignatureImpl [name=").append(getName())
81 .append(", comment=").append(getComment())
82 .append(", definingType=");
84 final Type defType = getDefiningType();
85 if (defType != null) {
86 builder.append(defType.getPackageName()).append('.').append(defType.getName());
88 builder.append(" null");
91 return builder.append(", returnType=").append(getReturnType())
92 .append(", params=").append(this.params)
93 .append(", annotations=").append(getAnnotations())
94 .append(']').toString();