Class 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.
    • Constructor Detail

      • 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.
    • Method Detail

      • 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.