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.controller.binding.generator.util.generated.type.builder;
11 import org.opendaylight.controller.sal.binding.model.api.AccessModifier;
12 import org.opendaylight.controller.sal.binding.model.api.AnnotationType;
13 import org.opendaylight.controller.sal.binding.model.api.Type;
14 import org.opendaylight.controller.sal.binding.model.api.TypeMember;
16 import java.util.Collections;
17 import java.util.List;
19 abstract class AbstractTypeMember implements TypeMember {
21 private final String name;
22 private final String comment;
23 private final Type definingType;
24 private final Type returnType;
25 private final List<AnnotationType> annotations;
26 private final boolean isFinal;
27 private final AccessModifier accessModifier;
29 public AbstractTypeMember(final Type definingType, final String name, final List<AnnotationType> annotations,
30 final String comment, final AccessModifier accessModifier, final Type returnType,
33 this.definingType = definingType;
35 this.annotations = Collections.unmodifiableList(annotations);
36 this.comment = comment;
37 this.accessModifier = accessModifier;
38 this.returnType = returnType;
39 this.isFinal = isFinal;
43 public List<AnnotationType> getAnnotations() {
48 public String getName() {
53 public String getComment() {
58 public Type getDefiningType() {
63 public AccessModifier getAccessModifier() {
64 return accessModifier;
68 public Type getReturnType() {
73 public boolean isFinal() {
78 public int hashCode() {
81 result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
82 result = prime * result
83 + ((getReturnType() == null) ? 0 : getReturnType().hashCode());
88 public boolean equals(Object obj) {
95 if (getClass() != obj.getClass()) {
98 MethodSignatureImpl other = (MethodSignatureImpl) obj;
99 if (getName() == null) {
100 if (other.getName() != null) {
103 } else if (!getName().equals(other.getName())) {
106 if (getReturnType() == null) {
107 if (other.getReturnType() != null) {
110 } else if (!getReturnType().equals(other.getReturnType())) {
117 public String toString() {
118 StringBuilder builder = new StringBuilder();
119 builder.append("MethodSignatureImpl [name=");
120 builder.append(getName());
121 builder.append(", comment=");
122 builder.append(getComment());
123 if (getDefiningType() != null) {
124 builder.append(", definingType=");
125 builder.append(getDefiningType().getPackageName());
127 builder.append(getDefiningType().getName());
129 builder.append(", definingType= null");
131 builder.append(", returnType=");
132 builder.append(getReturnType());
133 builder.append(", annotations=");
134 builder.append(getAnnotations());
136 return builder.toString();