Package org.bson

Enum UuidRepresentation

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<UuidRepresentation>

    public enum UuidRepresentation
    extends java.lang.Enum<UuidRepresentation>
    The representation to use when converting a UUID to a BSON binary value. This class is necessary because the different drivers used to have different ways of encoding UUID, with the BSON subtype: \x03 UUID old.
    Since:
    3.0
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      C_SHARP_LEGACY
      The legacy representation of UUID used by the C# driver BSON binary subtype 3
      JAVA_LEGACY
      The legacy representation of UUID used by the Java driver BSON binary subtype 3
      PYTHON_LEGACY
      The legacy representation of UUID used by the Python driver, which is the same format as STANDARD, but has the UUID old BSON subtype (\x03) BSON binary subtype 3
      STANDARD
      The canonical representation of UUID BSON binary subtype 4
      UNSPECIFIED
      An unspecified representation of UUID.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static UuidRepresentation valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static UuidRepresentation[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • UNSPECIFIED

        public static final UuidRepresentation UNSPECIFIED
        An unspecified representation of UUID. Essentially, this is the null representation value.
        Since:
        3.12
      • STANDARD

        public static final UuidRepresentation STANDARD
        The canonical representation of UUID BSON binary subtype 4
      • C_SHARP_LEGACY

        public static final UuidRepresentation C_SHARP_LEGACY
        The legacy representation of UUID used by the C# driver BSON binary subtype 3
      • JAVA_LEGACY

        public static final UuidRepresentation JAVA_LEGACY
        The legacy representation of UUID used by the Java driver BSON binary subtype 3
      • PYTHON_LEGACY

        public static final UuidRepresentation PYTHON_LEGACY
        The legacy representation of UUID used by the Python driver, which is the same format as STANDARD, but has the UUID old BSON subtype (\x03) BSON binary subtype 3
    • Method Detail

      • values

        public static UuidRepresentation[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (UuidRepresentation c : UuidRepresentation.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static UuidRepresentation valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null