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.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import org.eclipse.jdt.annotation.NonNull;
16 * It is used only as ancestor for other <code>Type</code>s. Note this forms the equality domain over most types, please
17 * consider joining the party.
20 public class AbstractBaseType implements Type {
22 * Name of this <code>Type</code>.
24 private final @NonNull JavaTypeName identifier;
27 * Constructs the instance of this class with a JavaTypeName.
29 * @param identifier for this <code>Type</code>
31 protected AbstractBaseType(final JavaTypeName identifier) {
32 this.identifier = requireNonNull(identifier);
36 public final JavaTypeName getIdentifier() {
37 return this.identifier;
41 public final int hashCode() {
42 return identifier.hashCode();
46 public final boolean equals(final Object obj) {
50 if (!(obj instanceof Type)) {
53 return identifier.equals(((Type) obj).getIdentifier());
57 public String toString() {
58 return "Type (" + getFullyQualifiedName() + ")";