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.Type;
15 import org.opendaylight.yangtools.sal.binding.model.api.TypeMember;
18 * @deprecated Use {@link org.opendaylight.mdsal.binding.generator.util.generated.type.builder.AbstractTypeMember} instead.
21 abstract class AbstractTypeMember implements TypeMember {
23 private final String name;
24 private final String comment;
25 private final Type definingType;
26 private final Type returnType;
27 private final List<AnnotationType> annotations;
28 private final boolean isFinal;
29 private final boolean isStatic;
30 private final AccessModifier accessModifier;
32 protected AbstractTypeMember(final Type definingType, final String name, final List<AnnotationType> annotations,
33 final String comment, final AccessModifier accessModifier, final Type returnType,
34 final boolean isFinal, final boolean isStatic) {
36 this.definingType = definingType;
38 this.annotations = annotations;
39 this.comment = comment;
40 this.accessModifier = accessModifier;
41 this.returnType = returnType;
42 this.isFinal = isFinal;
43 this.isStatic = isStatic;
47 public List<AnnotationType> getAnnotations() {
52 public String getName() {
57 public String getComment() {
62 public Type getDefiningType() {
67 public AccessModifier getAccessModifier() {
68 return accessModifier;
72 public Type getReturnType() {
77 public boolean isFinal() {
82 public boolean isStatic() {
87 public int hashCode() {
90 result = prime * result + Objects.hashCode(getName());
91 result = prime * result + Objects.hashCode(getReturnType());
96 public boolean equals(final Object obj) {
103 if (getClass() != obj.getClass()) {
106 AbstractTypeMember other = (AbstractTypeMember) obj;
107 return Objects.equals(getName(), other.getName()) && Objects.equals(getReturnType(), other.getReturnType());
111 public String toString() {
112 StringBuilder builder = new StringBuilder();
113 builder.append("MethodSignatureImpl [name=");
114 builder.append(getName());
115 builder.append(", comment=");
116 builder.append(getComment());
117 if (getDefiningType() != null) {
118 builder.append(", definingType=");
119 builder.append(getDefiningType().getPackageName());
121 builder.append(getDefiningType().getName());
123 builder.append(", definingType= null");
125 builder.append(", returnType=");
126 builder.append(getReturnType());
127 builder.append(", annotations=");
128 builder.append(getAnnotations());
130 return builder.toString();