Enum JacksonDataFormat

  • All Implemented Interfaces:
    Serializable, Comparable<JacksonDataFormat>

    public enum JacksonDataFormat
    extends Enum<JacksonDataFormat>
    Represents the detected type of a String.

    Currently only supports JSON, XML, and YAML formats.

    See Also:
    DataFormatDetector
    Implementation Note:
    Uses Jackson under the covers. You will need to ensure that jackson-core, jackson-dataformat-xml and jackson-dataformat-yaml dependencies are present at runtime.
    • Method Detail

      • values

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

        public static JacksonDataFormat valueOf​(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:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • from

        public static JacksonDataFormat from​(String formatName)
        Returns one of the enum constants for the given formatName, or UNKNOWN if the format name is not found.

        The formatName must match exactly (i.e. is case-sensitive).

        Parameters:
        formatName - the format name as a String
        Returns:
        the JacksonDataFormat corresponding to the given format name (exact match)
        API Note:
        See the getFormatName() method which returns the name of the returned format
        Implementation Note:
        Format names are the values of the public constants in the appropriate Jackson JsonFactory and its subclasses.