org.uncommons.util.id
Class StringPrefixIDSource
java.lang.Object
org.uncommons.util.id.StringPrefixIDSource
- All Implemented Interfaces:
- IDSource<String>
public class StringPrefixIDSource
- extends Object
- implements IDSource<String>
Thread-safe ID source that wraps another source of IDs and adds a fixed String
prefix to each ID generated.
- Author:
- Daniel Dyer
|
Method Summary |
String |
nextID()
Implementing classes are responsible for synchronization if concurrent invocations
of this method are required. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringPrefixIDSource
public StringPrefixIDSource(String prefix,
IDSource<?> source)
- Parameters:
prefix - A fixed String that is attached to the front of each ID.source - The source of IDs to which the prefix is added.
nextID
public String nextID()
- Implementing classes are responsible for synchronization if concurrent invocations
of this method are required.
- Specified by:
nextID in interface IDSource<String>
- Returns:
- The next ID.