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.ri.generated.type.builder;
10 import java.util.List;
11 import java.util.Objects;
12 import org.opendaylight.yangtools.binding.model.api.AccessModifier;
13 import org.opendaylight.yangtools.binding.model.api.AnnotationType;
14 import org.opendaylight.yangtools.binding.model.api.Type;
15 import org.opendaylight.yangtools.binding.model.api.TypeMember;
16 import org.opendaylight.yangtools.binding.model.api.TypeMemberComment;
18 abstract class AbstractTypeMember implements TypeMember {
20 private final String name;
21 private final TypeMemberComment comment;
22 private final Type returnType;
23 private final List<AnnotationType> annotations;
24 private final boolean isFinal;
25 private final boolean isStatic;
26 private final AccessModifier accessModifier;
28 protected AbstractTypeMember(final String name, final List<AnnotationType> annotations,
29 final TypeMemberComment comment, final AccessModifier accessModifier, final Type returnType,
30 final boolean isFinal, final boolean isStatic) {
32 this.annotations = annotations;
33 this.comment = comment;
34 this.accessModifier = accessModifier;
35 this.returnType = returnType;
36 this.isFinal = isFinal;
37 this.isStatic = isStatic;
41 public List<AnnotationType> getAnnotations() {
42 return this.annotations;
46 public String getName() {
51 public TypeMemberComment getComment() {
56 public AccessModifier getAccessModifier() {
57 return this.accessModifier;
61 public Type getReturnType() {
62 return this.returnType;
66 public boolean isFinal() {
71 public boolean isStatic() {
76 public int hashCode() {
77 return Objects.hash(getName(), getReturnType());
81 public boolean equals(final Object obj) {
85 if (obj == null || getClass() != obj.getClass()) {
88 final AbstractTypeMember other = (AbstractTypeMember) obj;
89 return Objects.equals(getName(), other.getName()) && Objects.equals(getReturnType(), other.getReturnType());
93 public String toString() {
94 return new StringBuilder()
95 .append("AbstractTypeMember [name=").append(getName())
96 .append(", comment=").append(getComment())
97 .append(", returnType=").append(getReturnType())
98 .append(", annotations=").append(getAnnotations())