Package org.kiwiproject.jackson
Enum JacksonDataFormat
- java.lang.Object
-
- java.lang.Enum<JacksonDataFormat>
-
- org.kiwiproject.jackson.JacksonDataFormat
-
- All Implemented Interfaces:
Serializable,Comparable<JacksonDataFormat>
public enum JacksonDataFormat extends Enum<JacksonDataFormat>
Represents the detected type of aString.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JacksonDataFormatfrom(String formatName)Returns one of the enum constants for the givenformatName, orUNKNOWNif the format name is not found.static JacksonDataFormatvalueOf(String name)Returns the enum constant of this type with the specified name.static JacksonDataFormat[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JSON
public static final JacksonDataFormat JSON
-
XML
public static final JacksonDataFormat XML
-
YAML
public static final JacksonDataFormat YAML
-
UNKNOWN
public static final JacksonDataFormat UNKNOWN
-
-
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 nameNullPointerException- if the argument is null
-
from
public static JacksonDataFormat from(String formatName)
Returns one of the enum constants for the givenformatName, orUNKNOWNif the format name is not found.The
formatNamemust 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
JsonFactoryand its subclasses.
-
-