2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.controller.binding.generator.util;
\r
10 import org.opendaylight.controller.sal.binding.model.api.Type;
\r
12 public class AbstractBaseType implements Type {
\r
14 private final String packageName;
\r
15 private final String name;
\r
18 public String getPackageName() {
\r
23 public String getName() {
\r
28 public String getFullyQualifiedName() {
\r
29 if (packageName.isEmpty()) {
\r
32 return packageName + "." + name;
\r
36 protected AbstractBaseType(String pkName, String name) {
\r
37 this.packageName = pkName;
\r
42 public int hashCode() {
\r
43 final int prime = 31;
\r
45 result = prime * result + ((name == null) ? 0 : name.hashCode());
\r
46 result = prime * result
\r
47 + ((packageName == null) ? 0 : packageName.hashCode());
\r
52 public boolean equals(Object obj) {
\r
57 if (getClass() != obj.getClass())
\r
59 Type other = (Type) obj;
\r
61 if (other.getName() != null)
\r
63 } else if (!name.equals(other.getName()))
\r
65 if (packageName == null) {
\r
66 if (other.getPackageName() != null)
\r
68 } else if (!packageName.equals(other.getPackageName()))
\r
74 public String toString() {
\r
75 if (packageName.isEmpty()) {
\r
76 return "Type (" + name + ")";
\r
78 return "Type (" + packageName + "." + name + ")";
\r