Package org.bson.json

Enum JsonMode

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

    public enum JsonMode
    extends java.lang.Enum<JsonMode>
    An enumeration of the supported output modes of JSONWriter.
    Since:
    3.0
    See Also:
    JsonWriter
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      EXTENDED
      Standard extended JSON representation.
      RELAXED
      Standard relaxed extended JSON representation.
      SHELL
      While not formally documented, this output mode will attempt to produce output that corresponds to what the MongoDB shell actually produces when showing query results.
      STRICT
      Deprecated.
      The format generated with this mode is no longer considered standard for MongoDB tools.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static JsonMode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static JsonMode[] 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

      • STRICT

        @Deprecated
        public static final JsonMode STRICT
        Deprecated.
        The format generated with this mode is no longer considered standard for MongoDB tools. This value is not currently scheduled for removal.
        Strict mode representations of BSON types conform to the JSON RFC spec.
      • SHELL

        public static final JsonMode SHELL
        While not formally documented, this output mode will attempt to produce output that corresponds to what the MongoDB shell actually produces when showing query results.
    • Method Detail

      • values

        public static JsonMode[] 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 (JsonMode c : JsonMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JsonMode 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