Enum Class BeanMapper.Format

java.lang.Object
java.lang.Enum<BeanMapper.Format>
com.norconex.commons.lang.bean.BeanMapper.Format
All Implemented Interfaces:
Serializable, Comparable<BeanMapper.Format>, Constable
Enclosing class:
BeanMapper

public static enum BeanMapper.Format extends Enum<BeanMapper.Format>
  • Enum Constant Details

  • Method Details

    • values

      public static BeanMapper.Format[] 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

      public static BeanMapper.Format valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • fromPath

      public static BeanMapper.Format fromPath(Path path)
      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 null if path is null or does not have a supported extension.
    • fromPath

      public static BeanMapper.Format fromPath(Path path, BeanMapper.Format defaultFormat)
      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
      defaultFormat - format returned if the path is null or does not have a supported extension
      Returns:
      the detected or default format
    • fromContent

      public static BeanMapper.Format fromContent(String content)
      Resolve the format based on supplied content.
      Parameters:
      content - the content to evaluate
      Returns:
      the detected format or null if the content is blank or the format could not be detected
    • fromContent

      public static BeanMapper.Format fromContent(String content, BeanMapper.Format defaultFormat)
      Resolve the format based on supplied content.
      Parameters:
      content - the content to evaluate
      defaultFormat - format returned if the content is blank or the format could not be detected
      Returns:
      the detected or default format