Eliminate org.opendaylight.mdsal.binding.generator.spi
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / mdsal / binding / model / api / AbstractType.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.model.api;
9
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.yangtools.concepts.AbstractSimpleIdentifiable;
12
13 /**
14  * It is used only as ancestor for other <code>Type</code>s. Note this forms the equality domain over most types, please
15  * consider joining the party.
16  */
17 @Beta
18 public abstract class AbstractType extends AbstractSimpleIdentifiable<JavaTypeName> implements Type {
19     /**
20      * Constructs the instance of this class with a JavaTypeName.
21      *
22      * @param identifier for this <code>Type</code>
23      */
24     protected AbstractType(final JavaTypeName identifier) {
25         super(identifier);
26     }
27
28     @Override
29     public final int hashCode() {
30         return getIdentifier().hashCode();
31     }
32
33     @Override
34     public final boolean equals(final Object obj) {
35         return this == obj || obj instanceof Type && getIdentifier().equals(((Type) obj).getIdentifier());
36     }
37 }