c1f0c2518a844fd4624cdc27dabaedb9993bf6f9
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / AbstractStringIdentifier.java
1 /*
2  * Copyright (c) 2016 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.util;
9
10 import com.google.common.annotations.Beta;
11 import java.util.UUID;
12 import org.opendaylight.yangtools.concepts.Identifier;
13
14 /**
15  * Utility {@link Identifier} backed by a {@link UUID}.
16  *
17  * @author Robert Varga
18  */
19 @Beta
20 public abstract class AbstractStringIdentifier<T extends AbstractStringIdentifier<T>>
21         extends AbstractIdentifier<String> implements Comparable<T> {
22     private static final long serialVersionUID = 1L;
23
24     protected AbstractStringIdentifier(final String string) {
25         super(string);
26     }
27
28     @Override
29     public final int compareTo(final T o) {
30         return getValue().compareTo(o.getValue());
31     }
32 }