Class FlagsUUID

  • All Implemented Interfaces:
    java.lang.Comparable<Address>, Address, Constructable<UUID>, SizeStreamable, Streamable
    Direct Known Subclasses:
    ExtendedUUID

    public class FlagsUUID
    extends UUID
    Subclass of UUID accommodating additional data such as a flag. There may be many instances in memory, and as they are serialized a lot and sent across the wire, I tried to make this as compact as possible.
    Since:
    3.5
    Author:
    Bela Ban
    • Field Detail

      • flags

        protected int flags
    • Constructor Detail

      • FlagsUUID

        public FlagsUUID()
      • FlagsUUID

        protected FlagsUUID​(byte[] data)
      • FlagsUUID

        public FlagsUUID​(long mostSigBits,
                         long leastSigBits)
      • FlagsUUID

        public FlagsUUID​(T other)
    • Method Detail

      • create

        public java.util.function.Supplier<? extends UUID> create()
        Description copied from interface: Constructable
        Creates an instance of the class implementing this interface
        Specified by:
        create in interface Constructable<UUID>
        Overrides:
        create in class UUID
      • randomUUID

        public static FlagsUUID randomUUID()
      • randomUUID

        public static FlagsUUID randomUUID​(java.lang.String name)
      • setFlag

        public <T extends FlagsUUID> T setFlag​(short flag)
      • clearFlag

        public <T extends FlagsUUID> T clearFlag​(short flag)
      • isFlagSet

        public boolean isFlagSet​(short flag)
      • addContents

        public <T extends FlagsUUID> T addContents​(T other)
      • writeTo

        public void writeTo​(java.io.DataOutput out)
                     throws java.io.IOException
        Description copied from interface: Streamable
        Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed
        Specified by:
        writeTo in interface Streamable
        Overrides:
        writeTo in class UUID
        Throws:
        java.io.IOException
      • readFrom

        public void readFrom​(java.io.DataInput in)
                      throws java.io.IOException
        Description copied from interface: Streamable
        Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
        Specified by:
        readFrom in interface Streamable
        Overrides:
        readFrom in class UUID
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class UUID