Migrate concepts to use JDT annotations
[yangtools.git] / common / concepts / src / main / java / org / opendaylight / yangtools / concepts / Identifier.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.yangtools.concepts;
9
10 import java.io.Serializable;
11 import javax.annotation.concurrent.ThreadSafe;
12
13 /**
14  * General identifier interface. It is primarily a marker for all things that identify concepts -- such as names,
15  * addresses, classes, etc. We do not require too much, just that the identifiers are serializable (and this
16  * transferable).
17  *
18  * <p>Implementations are expected to implement {@link #hashCode()} and {@link #equals(Object)} methods in a way,
19  * which ensures that objects before and after serialization are considered equal.
20  *
21  * <p>Implementations are advised to use the {@link java.io.Externalizable} Proxy pattern to allow future evolution
22  * of their serialization format. For further efficiency, implementation should implement {@link WritableObject},
23  * so they can be efficiently embedded in other {@link Serializable} objects.
24  *
25  * <p>Note that this class is annotated as {@link ThreadSafe}, hence all implementations are expected to be
26  * thread-safe.
27  */
28 @ThreadSafe
29 public interface Identifier extends Serializable, Immutable {
30     @Override
31     boolean equals(Object obj);
32
33     @Override
34     int hashCode();
35
36     @Override
37     String toString();
38 }
39