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;
10 import java.util.Objects;
11 import org.opendaylight.yangtools.sal.binding.model.api.Type;
14 * It is used only as ancestor for other <code>Type</code>s
16 * @deprecated Use {@link org.opendaylight.mdsal.binding.generator.util.AbstractBaseType} instead.
19 public class AbstractBaseType implements Type {
22 * Name of the package to which this <code>Type</code> belongs.
24 private final String packageName;
27 * Name of this <code>Type</code>.
29 private final String name;
32 public String getPackageName() {
37 public String getName() {
42 public String getFullyQualifiedName() {
43 if (packageName.isEmpty()) {
46 return packageName + "." + name;
51 * Constructs the instance of this class with the concrete package name type
55 * string with the package name to which this <code>Type</code>
58 * string with the name for this <code>Type</code>
60 protected AbstractBaseType(final String pkName, final String name) {
62 throw new IllegalArgumentException("Package Name for Generated Type cannot be null!");
65 throw new IllegalArgumentException("Name of Generated Type cannot be null!");
67 this.packageName = pkName;
72 public int hashCode() {
75 result = prime * result + Objects.hashCode(name);
76 result = prime * result + Objects.hashCode(packageName);
81 public boolean equals(final Object obj) {
88 if (!(obj instanceof Type)) {
91 Type other = (Type) obj;
92 return Objects.equals(name, other.getName()) && Objects.equals(packageName, other.getPackageName());
96 public String toString() {
97 if (packageName.isEmpty()) {
98 return "Type (" + name + ")";
100 return "Type (" + packageName + "." + name + ")";