Package com.norconex.commons.lang.bean
Enum Class BeanMapper.Format
- All Implemented Interfaces:
Serializable,Comparable<BeanMapper.Format>,Constable
- Enclosing class:
BeanMapper
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic BeanMapper.FormatfromContent(String content) Resolve the format based on supplied content.static BeanMapper.FormatfromContent(String content, BeanMapper.Format defaultFormat) Resolve the format based on supplied content.static BeanMapper.FormatResolve the format based on the file extension for a given path.static BeanMapper.FormatfromPath(Path path, BeanMapper.Format defaultFormat) Resolve the format based on the file extension for a given path.static BeanMapper.FormatReturns the enum constant of this class with the specified name.static BeanMapper.Format[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
XML
-
JSON
-
YAML
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
fromPath
Resolve the format based on the file extension for a given path. Supported extensions are ".json", ".yaml", ".yml", and ".xml" (all case-insensitive).- Parameters:
path- the path to evaluate- Returns:
- the detected format or
nullif path isnullor does not have a supported extension.
-
fromPath
Resolve the format based on the file extension for a given path. Supported extensions are ".json", ".yaml", ".yml", and ".xml" (all case-insensitive).- Parameters:
path- the path to evaluatedefaultFormat- format returned if the path isnullor does not have a supported extension- Returns:
- the detected or default format
-
fromContent
Resolve the format based on supplied content.- Parameters:
content- the content to evaluate- Returns:
- the detected format or
nullif the content is blank or the format could not be detected
-
fromContent
Resolve the format based on supplied content.- Parameters:
content- the content to evaluatedefaultFormat- format returned if the content is blank or the format could not be detected- Returns:
- the detected or default format
-