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.util;
10 import static java.util.Objects.requireNonNull;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
14 import org.opendaylight.mdsal.binding.model.api.Type;
17 * It is used only as ancestor for other <code>Type</code>s.
19 public class AbstractBaseType implements Type {
21 * Name of this <code>Type</code>.
23 private final @NonNull JavaTypeName identifier;
26 * Constructs the instance of this class with a JavaTypeName.
28 * @param identifier for this <code>Type</code>
30 protected AbstractBaseType(final JavaTypeName identifier) {
31 this.identifier = requireNonNull(identifier);
35 public final JavaTypeName getIdentifier() {
36 return this.identifier;
40 public int hashCode() {
41 return identifier.hashCode();
45 public boolean equals(final Object obj) {
52 if (!(obj instanceof Type)) {
55 final Type other = (Type) obj;
56 return identifier.equals(other.getIdentifier());
60 public String toString() {
61 return "Type (" + getFullyQualifiedName() + ")";