Class MetaData

java.lang.Object
io.github.qubitpi.athena.metadata.MetaData

@Immutable @ThreadSafe public class MetaData extends Object
MetaData is provides information about File, but not the content of the file.

MetaData offers the ability to make uploaded metadata and metadata from GraphQL ExecutionResult type-safe.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Attribute name for filename in metadata object.
    static final String
    Attribute name for FileType in metadata object.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    Returns the name of the file associated with this metadata instance.
    @NotNull FileType
    Returns the extension info of the file associated with this metadata instance.
    static @NotNull MetaData
    of(@NotNull graphql.ExecutionResult executionResult)
    Given a GraphQL query result, constructs an athena representation of a file metadata contained in that result.
    static @NotNull MetaData
    of(@NotNull Map<String,Object> fieldMap)
    Given a set of key-value pairs, constructs an athena representation of a file metadata whose states are based on the specified key-value pairs.
    static @NotNull MetaData
    of(@NotNull org.glassfish.jersey.media.multipart.FormDataContentDisposition uploadedMetaData)
    Given a form-data content disposition header from a file upload request, constructs an athena representation of the uploaded file metadata.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • of

      @NotNull public static @NotNull MetaData of(@NotNull @NotNull org.glassfish.jersey.media.multipart.FormDataContentDisposition uploadedMetaData)
      Given a form-data content disposition header from a file upload request, constructs an athena representation of the uploaded file metadata.
      Parameters:
      uploadedMetaData - The file metadata object from HTTP request
      Returns:
      a new instance
      Throws:
      NullPointerException - if uploadedMetaData is null
    • of

      @NotNull public static @NotNull MetaData of(@NotNull @NotNull graphql.ExecutionResult executionResult)
      Given a GraphQL query result, constructs an athena representation of a file metadata contained in that result.
      Parameters:
      executionResult - The native GraphQL result
      Returns:
      a new instance
      Throws:
      NullPointerException - if executionResult is null
    • of

      @NotNull public static @NotNull MetaData of(@NotNull @NotNull Map<String,Object> fieldMap)
      Given a set of key-value pairs, constructs an athena representation of a file metadata whose states are based on the specified key-value pairs.

      The set of pairs must be a map with the following two keys, each of which has non-null values:

      Parameters:
      fieldMap - The provided key-value pairs
      Returns:
      a new instance
      Throws:
      IllegalArgumentException - if the key-value pairs are missing one of FILE_NAME or FILE_TYPE keys
    • getFileName

      @NotNull public @NotNull String getFileName()
      Returns the name of the file associated with this metadata instance.
      Returns:
      the file name, including its extension
    • getFileType

      @NotNull public @NotNull FileType getFileType()
      Returns the extension info of the file associated with this metadata instance.
      Returns:
      file type information