Class Attachment.Builder

java.lang.Object
dev.learning.xapi.model.Attachment.Builder
Enclosing class:
Attachment

public static class Attachment.Builder extends Object
Builder for Attachment.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • addDisplay

      public Attachment.Builder addDisplay(Locale key, String value)
      Adds a display value.
      Parameters:
      key - The key of the entry.
      value - The value of the entry.
      Returns:
      This builder
      See Also:
      • Attachment.description
    • addDescription

      public Attachment.Builder addDescription(Locale key, String value)
      Adds a description of the Attachment.
      Parameters:
      key - The key of the entry.
      value - The value of the entry.
      Returns:
      This builder
      See Also:
      • Attachment.description
    • sha2

      public Attachment.Builder sha2(String sha2)

      Sets SHA-2 hash of the Attachment.

      The sha2 is set ONLY if the content property was not set yet. (otherwise the sha2 is calculated automatically)

      Parameters:
      sha2 - The SHA-2 hash of the Attachment data.
      Returns:
      This builder
    • content

      public Attachment.Builder content(byte[] content)

      Sets data of the Attachment.

      This method also automatically calculates the SHA-2 hash for the data.

      Parameters:
      content - The data of the Attachment as a byte array.
      Returns:
      This builder
    • content

      public Attachment.Builder content(String content)

      Sets data of the Attachment as a String.

      This is a convenient method for creating text attachments.

      Parameters:
      content - The data of the Attachment as a String.
      Returns:
      This builder
      See Also: