Class ToFinestTimeUUID

  • All Implemented Interfaces:
    java.util.function.LongFunction<java.util.UUID>

    public class ToFinestTimeUUID
    extends java.lang.Object
    implements java.util.function.LongFunction<java.util.UUID>
    Converts a count of 100ns intervals from 1582 Julian to a Type1 TimeUUID according to RFC 4122. This allows you to access the finest unit of resolution for the purposes of simulating a large set of unique timeuuid values. This offers 10000 times more unique values per ms than ToEpochTimeUUID. For the variants that have a String argument in the constructor, this is a parsable datetime that is used as the base time for all produced values. Setting this allows you to set the start of the time range for all timeuuid values produced. All times are parsed for UTC. All time use ISO date ordering, meaning that the most significant fields always go before the others. The valid formats, in joda specifier form are:
    1. yyyy-MM-dd HH:mm:ss.SSSZ, for example: 2015-02-28 23:30:15.223
    2. yyyy-MM-dd HH:mm:ss, for example 2015-02-28 23:30:15
    3. yyyyMMdd'T'HHmmss.SSSZ, for example: 20150228T233015.223
    4. yyyyMMdd'T'HHmmssZ, for example: 20150228T233015
    5. yyyy-MM-dd, for example: 2015-02-28
    6. yyyyMMdd, for example: 20150228
    7. yyyyMM, for example: 201502
    8. yyyy, for example: 2015
    • Constructor Summary

      Constructors 
      Constructor Description
      ToFinestTimeUUID()
      Create version 1 timeuuids with a per-host node and empty clock data.
      ToFinestTimeUUID​(long node)
      Create version 1 timeuuids with a specific static node and empty clock data.
      ToFinestTimeUUID​(long node, long clock)
      Create version 1 timeuuids with a specific static node and specific clock data.
      ToFinestTimeUUID​(java.lang.String baseTimeSpec)
      Create version 1 timeuuids with a per-host node and empty clock data.
      ToFinestTimeUUID​(java.lang.String baseTimeSpec, long node)
      Create version 1 timeuuids with a specific static node and empty clock data.
      ToFinestTimeUUID​(java.lang.String baseTimeSpec, long node, long clock)
      Create version 1 timeuuids with a specific static node and specific clock data.
    • Method Summary

      Modifier and Type Method Description
      java.util.UUID apply​(long timeClicks)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ToFinestTimeUUID

        public ToFinestTimeUUID()
        Create version 1 timeuuids with a per-host node and empty clock data. The node and clock components are seeded from network interface data. In this case, the clock data is not seeded uniquely.
      • ToFinestTimeUUID

        public ToFinestTimeUUID​(long node)
        Create version 1 timeuuids with a specific static node and empty clock data. This is useful for testing so that you can know that values are verifiable, even though in non-testing practice, you would rely on some form of entropy per-system to provide more practical dispersion of values over reboots, etc.
        Parameters:
        node - a fixture value for testing that replaces node and clock bits
      • ToFinestTimeUUID

        public ToFinestTimeUUID​(long node,
                                long clock)
        Create version 1 timeuuids with a specific static node and specific clock data. This is useful for testing so that you can know that values are verifiable, even though in non-testing practice, you would rely on some form of entropy per-system to provide more practical dispersion of values over reboots, etc.
        Parameters:
        node - a fixture value for testing that replaces node bits
        clock - a fixture value for testing that replaces clock bits
      • ToFinestTimeUUID

        public ToFinestTimeUUID​(java.lang.String baseTimeSpec)
        Create version 1 timeuuids with a per-host node and empty clock data. The node and clock components are seeded from network interface data. In this case, the clock data is not seeded uniquely.
        Parameters:
        baseTimeSpec - - a string specification for the base time value
      • ToFinestTimeUUID

        public ToFinestTimeUUID​(java.lang.String baseTimeSpec,
                                long node)
        Create version 1 timeuuids with a specific static node and empty clock data. This is useful for testing so that you can know that values are verifiable, even though in non-testing practice, you would rely on some form of entropy per-system to provide more practical dispersion of values over reboots, etc.
        Parameters:
        baseTimeSpec - - a string specification for the base time value
        node - a fixture value for testing that replaces node and clock bits
      • ToFinestTimeUUID

        public ToFinestTimeUUID​(java.lang.String baseTimeSpec,
                                long node,
                                long clock)
        Create version 1 timeuuids with a specific static node and specific clock data. This is useful for testing so that you can know that values are verifiable, even though in non-testing practice, you would rely on some form of entropy per-system to provide more practical dispersion of values over reboots, etc.
        Parameters:
        node - a fixture value for testing that replaces node bits
        clock - a fixture value for testing that replaces clock bits
        baseTimeSpec - - a string specification for the base time value
    • Method Detail

      • apply

        public java.util.UUID apply​(long timeClicks)
        Specified by:
        apply in interface java.util.function.LongFunction<java.util.UUID>