Class BasicUUID

java.lang.Object
org.apache.derby.impl.services.uuid.BasicUUID
All Implemented Interfaces:
Externalizable, Serializable, UUID, Formatable, TypedFormat

public class BasicUUID extends Object implements UUID, Formatable
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private long
     
    private int
     
    private long
     

    Fields inherited from interface org.apache.derby.catalog.UUID

    NULL, UUID_BYTE_LENGTH
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    BasicUUID(long majorId, long timemillis, int sequence)
    Constructor only called by BasicUUIDFactory.
    BasicUUID(String uuidstring)
    Constructor only called by BasicUUIDFactory.
  • Method Summary

    Modifier and Type
    Method
    Description
    Clone this UUID.
    boolean
    equals(Object otherObject)
    Implement value equality.
    int
    Return my format identifier.
    int
    Provide a hashCode which is compatible with the equals() method.
    void
    Read this in
    private static long
    Read a long value, msb first, from its character representation in the string reader, using '-' or end of string to delimit.
    stringWorkhorse(char separator)
    Private workhorse of the string making routines.
    Produce a string representation of this UUID which is suitable for use as a unique ANSI identifier.
    Produce a string representation of this UUID which can be passed to UUIDFactory.recreateUUID later on to reconstruct it.
    void
    Write this out.
    private static void
    writeMSB(char[] data, int offset, long value, int nbytes)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • majorId

      private long majorId
    • timemillis

      private long timemillis
    • sequence

      private int sequence
  • Constructor Details

    • BasicUUID

      public BasicUUID(long majorId, long timemillis, int sequence)
      Constructor only called by BasicUUIDFactory.
    • BasicUUID

      public BasicUUID(String uuidstring)
      Constructor only called by BasicUUIDFactory. Constructs a UUID from the string representation produced by toString.
      See Also:
    • BasicUUID

      public BasicUUID()
  • Method Details

    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Write this out.
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException - error writing to log stream
    • readExternal

      public void readExternal(ObjectInput in) throws IOException
      Read this in
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException - error reading from log stream
    • getTypeFormatId

      public int getTypeFormatId()
      Return my format identifier.
      Specified by:
      getTypeFormatId in interface TypedFormat
      Returns:
      The identifier. (A UUID stuffed in an array of 16 bytes).
    • writeMSB

      private static void writeMSB(char[] data, int offset, long value, int nbytes)
    • readMSB

      private static long readMSB(StringReader sr)
      Read a long value, msb first, from its character representation in the string reader, using '-' or end of string to delimit.
    • equals

      public boolean equals(Object otherObject)
      Implement value equality.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Provide a hashCode which is compatible with the equals() method.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Produce a string representation of this UUID which can be passed to UUIDFactory.recreateUUID later on to reconstruct it. The funny representation is designed to (sort of) match the format of Microsoft's UUIDGEN utility.
      Overrides:
      toString in class Object
    • toANSIidentifier

      public String toANSIidentifier()
      Produce a string representation of this UUID which is suitable for use as a unique ANSI identifier.
      Specified by:
      toANSIidentifier in interface UUID
    • stringWorkhorse

      public String stringWorkhorse(char separator)
      Private workhorse of the string making routines.
      Parameters:
      separator - Character to separate number blocks. Null means do not include a separator.
      Returns:
      string representation of UUID.
    • cloneMe

      public UUID cloneMe()
      Clone this UUID.
      Specified by:
      cloneMe in interface UUID
      Returns:
      a copy of this UUID