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 static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.VisibleForTesting;
13 import java.util.List;
14 import java.util.Objects;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.opendaylight.mdsal.binding.model.api.AccessModifier;
17 import org.opendaylight.mdsal.binding.model.api.AnnotationType;
18 import org.opendaylight.mdsal.binding.model.api.MethodSignature;
19 import org.opendaylight.mdsal.binding.model.api.Type;
20 import org.opendaylight.mdsal.binding.model.api.TypeMemberComment;
22 class MethodSignatureImpl extends AbstractTypeMember implements MethodSignature {
23 private final List<Parameter> params;
24 private final @NonNull ValueMechanics mechanics;
25 private final boolean isAbstract;
26 private final boolean isDefault;
29 MethodSignatureImpl(final String name, final List<AnnotationType> annotations,
30 final TypeMemberComment comment, final AccessModifier accessModifier, final Type returnType,
31 final List<Parameter> params, final boolean isFinal, final boolean isAbstract, final boolean isStatic) {
32 this(name, annotations, comment, accessModifier, returnType, params, isFinal, isAbstract, isStatic, false,
33 ValueMechanics.NORMAL);
36 MethodSignatureImpl(final String name, final List<AnnotationType> annotations,
37 final TypeMemberComment comment, final AccessModifier accessModifier, final Type returnType,
38 final List<Parameter> params, final boolean isFinal, final boolean isAbstract, final boolean isStatic,
39 final boolean isDefault, final ValueMechanics mechanics) {
40 super(name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
42 this.isAbstract = isAbstract;
43 this.isDefault = isDefault;
44 this.mechanics = requireNonNull(mechanics);
48 public boolean isAbstract() {
49 return this.isAbstract;
53 public boolean isDefault() {
58 public List<Parameter> getParameters() {
63 public ValueMechanics getMechanics() {
68 public int hashCode() {
71 result = prime * result + Objects.hashCode(getName());
72 result = prime * result + Objects.hashCode(this.params);
73 result = prime * result + Objects.hashCode(getReturnType());
78 public boolean equals(final Object obj) {
82 if (obj == null || getClass() != obj.getClass()) {
85 final MethodSignatureImpl other = (MethodSignatureImpl) obj;
86 return Objects.equals(getName(), other.getName())
87 && Objects.equals(this.params, other.params)
88 && Objects.equals(getReturnType(), other.getReturnType());
92 public String toString() {
93 return new StringBuilder()
94 .append("MethodSignatureImpl [name=").append(getName())
95 .append(", comment=").append(getComment())
96 .append(", returnType=").append(getReturnType())
97 .append(", params=").append(this.params)
98 .append(", annotations=").append(getAnnotations())