Interface MultipartFormData.Pair

Enclosing interface:
MultipartFormData

public static interface MultipartFormData.Pair
A key-value pair that represents a segment of a multi-part form data. Can contain values corresponding a form field content, an upload file content, etc.
  • Method Details

    • of

      static MultipartFormData.Pair of(String key, String value)
      Returns the Pair instance for the given key and value.

      The key-value pair that represents a segment of a multi-part form data. Can contain values corresponding a form field content, an upload file content, etc.

      Parameters:
      key - the form content segment key
      value - the string representing the form content segment value. Can be empty if the key does not correspond to any value. For example, an empty form field
      Throws:
      IllegalArgumentException - when key is empty or blank
    • of

      static MultipartFormData.Pair of(String key, File value)
      Returns the Pair instance for the given key and value.

      The key-value pair that represents a segment of a multi-part form data. Can contain values corresponding a form field content, an upload file content, etc.

      Parameters:
      key - the form content segment key or blank
      value - the segment value representing the file content
      Throws:
      IllegalArgumentException - when key is empty
    • key

      default String key()
      Returns a string that represents the form content segment key.
    • stringValue

      default Optional<String> stringValue()
      Returns the form content segment value as a string.
    • fileValue

      default Optional<File> fileValue()
      Returns the form content segment value as a file.