Class File.Builder

java.lang.Object
security.whisper.javastix.coo.objects.File.Builder
Enclosing class:
File

@NotThreadSafe public static final class File.Builder extends Object
Builds instances of type File. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      @CanIgnoreReturnValue public final File.Builder from(BundleableObject instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.bundle.BundleableObject instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      @CanIgnoreReturnValue public final File.Builder from(StixCustomProperties instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.common.StixCustomProperties instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      @CanIgnoreReturnValue public final File.Builder from(CyberObservableObjectCommonProperties instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.coo.CyberObservableObjectCommonProperties instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      @CanIgnoreReturnValue public final File.Builder from(FileCoo instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.coo.objects.FileCoo instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • putHash

      @CanIgnoreReturnValue public final File.Builder putHash(String key, String value)
      Put one entry to the hashes map.
      Parameters:
      key - The key in the hashes map
      value - The associated value in the hashes map
      Returns:
      this builder for use in a chained invocation
    • putHash

      @CanIgnoreReturnValue public final File.Builder putHash(Map.Entry<String,? extends String> entry)
      Put one entry to the hashes map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • hashes

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies a dictionary of hashes for the contents of the file.") public final File.Builder hashes(Map<String,? extends String> entries)
      Sets or replaces all mappings from the specified map as entries for the hashes map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the hashes map
      Returns:
      this builder for use in a chained invocation
    • putAllHashes

      @CanIgnoreReturnValue public final File.Builder putAllHashes(Map<String,? extends String> entries)
      Put all mappings from the specified map as entries to hashes map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the hashes map
      Returns:
      this builder for use in a chained invocation
    • size

      @CanIgnoreReturnValue public final File.Builder size(long size)
      Initializes the optional value size to size.
      Parameters:
      size - The value for size
      Returns:
      this builder for chained invocation
    • size

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the size of the file, in bytes, as a non-negative integer.") public final File.Builder size(Optional<Long> size)
      Initializes the optional value size to size.
      Parameters:
      size - The value for size
      Returns:
      this builder for use in a chained invocation
    • name

      @CanIgnoreReturnValue public final File.Builder name(String name)
      Initializes the optional value name to name.
      Parameters:
      name - The value for name
      Returns:
      this builder for chained invocation
    • name

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the name of the file.") public final File.Builder name(Optional<String> name)
      Initializes the optional value name to name.
      Parameters:
      name - The value for name
      Returns:
      this builder for use in a chained invocation
    • nameEnc

      @CanIgnoreReturnValue public final File.Builder nameEnc(String nameEnc)
      Initializes the optional value nameEnc to nameEnc.
      Parameters:
      nameEnc - The value for nameEnc
      Returns:
      this builder for chained invocation
    • nameEnc

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the observed encoding for the name of the file.") public final File.Builder nameEnc(Optional<String> nameEnc)
      Initializes the optional value nameEnc to nameEnc.
      Parameters:
      nameEnc - The value for nameEnc
      Returns:
      this builder for use in a chained invocation
    • magicNumberHex

      @CanIgnoreReturnValue public final File.Builder magicNumberHex(String magicNumberHex)
      Initializes the optional value magicNumberHex to magicNumberHex.
      Parameters:
      magicNumberHex - The value for magicNumberHex
      Returns:
      this builder for chained invocation
    • magicNumberHex

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the hexadecimal constant (\'magic number\') associated with a specific file format that corresponds to the file, if applicable.") public final File.Builder magicNumberHex(Optional<String> magicNumberHex)
      Initializes the optional value magicNumberHex to magicNumberHex.
      Parameters:
      magicNumberHex - The value for magicNumberHex
      Returns:
      this builder for use in a chained invocation
    • mimeType

      @CanIgnoreReturnValue public final File.Builder mimeType(String mimeType)
      Initializes the optional value mimeType to mimeType.
      Parameters:
      mimeType - The value for mimeType
      Returns:
      this builder for chained invocation
    • mimeType

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the MIME type name specified for the file, e.g., \'application/msword\'.") public final File.Builder mimeType(Optional<String> mimeType)
      Initializes the optional value mimeType to mimeType.
      Parameters:
      mimeType - The value for mimeType
      Returns:
      this builder for use in a chained invocation
    • created

      @CanIgnoreReturnValue public final File.Builder created(StixInstant created)
      Initializes the optional value created to created.
      Parameters:
      created - The value for created
      Returns:
      this builder for chained invocation
    • created

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the date/time the file was created.") public final File.Builder created(Optional<? extends StixInstant> created)
      Initializes the optional value created to created.
      Parameters:
      created - The value for created
      Returns:
      this builder for use in a chained invocation
    • modified

      @CanIgnoreReturnValue public final File.Builder modified(StixInstant modified)
      Initializes the optional value modified to modified.
      Parameters:
      modified - The value for modified
      Returns:
      this builder for chained invocation
    • modified

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the date/time the file was last written to/modified.") public final File.Builder modified(Optional<? extends StixInstant> modified)
      Initializes the optional value modified to modified.
      Parameters:
      modified - The value for modified
      Returns:
      this builder for use in a chained invocation
    • accessed

      @CanIgnoreReturnValue public final File.Builder accessed(StixInstant accessed)
      Initializes the optional value accessed to accessed.
      Parameters:
      accessed - The value for accessed
      Returns:
      this builder for chained invocation
    • accessed

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the date/time the file was last accessed.") public final File.Builder accessed(Optional<? extends StixInstant> accessed)
      Initializes the optional value accessed to accessed.
      Parameters:
      accessed - The value for accessed
      Returns:
      this builder for use in a chained invocation
    • parentDirectoryRef

      @CanIgnoreReturnValue public final File.Builder parentDirectoryRef(String parentDirectoryRef)
      Initializes the optional value parentDirectoryRef to parentDirectoryRef.
      Parameters:
      parentDirectoryRef - The value for parentDirectoryRef
      Returns:
      this builder for chained invocation
    • parentDirectoryRef

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the parent directory of the file, as a reference to a Directory Object.") public final File.Builder parentDirectoryRef(Optional<String> parentDirectoryRef)
      Initializes the optional value parentDirectoryRef to parentDirectoryRef.
      Parameters:
      parentDirectoryRef - The value for parentDirectoryRef
      Returns:
      this builder for use in a chained invocation
    • isEncrypted

      @CanIgnoreReturnValue public final File.Builder isEncrypted(boolean isEncrypted)
      Initializes the optional value isEncrypted to isEncrypted.
      Parameters:
      isEncrypted - The value for isEncrypted
      Returns:
      this builder for chained invocation
    • isEncrypted

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies whether the file is encrypted.") public final File.Builder isEncrypted(Optional<Boolean> isEncrypted)
      Initializes the optional value isEncrypted to isEncrypted.
      Parameters:
      isEncrypted - The value for isEncrypted
      Returns:
      this builder for use in a chained invocation
    • encryptionAlgorithm

      @CanIgnoreReturnValue public final File.Builder encryptionAlgorithm(String encryptionAlgorithm)
      Initializes the optional value encryptionAlgorithm to encryptionAlgorithm.
      Parameters:
      encryptionAlgorithm - The value for encryptionAlgorithm
      Returns:
      this builder for chained invocation
    • encryptionAlgorithm

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the name of the encryption algorithm used to encrypt the file. Open Vocabulary - encryption-algorithm-ov") public final File.Builder encryptionAlgorithm(Optional<String> encryptionAlgorithm)
      Initializes the optional value encryptionAlgorithm to encryptionAlgorithm.
      Parameters:
      encryptionAlgorithm - The value for encryptionAlgorithm
      Returns:
      this builder for use in a chained invocation
    • decryptionKey

      @CanIgnoreReturnValue public final File.Builder decryptionKey(String decryptionKey)
      Initializes the optional value decryptionKey to decryptionKey.
      Parameters:
      decryptionKey - The value for decryptionKey
      Returns:
      this builder for chained invocation
    • decryptionKey

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the decryption key used to decrypt the archive file.") public final File.Builder decryptionKey(Optional<String> decryptionKey)
      Initializes the optional value decryptionKey to decryptionKey.
      Parameters:
      decryptionKey - The value for decryptionKey
      Returns:
      this builder for use in a chained invocation
    • contentRef

      @CanIgnoreReturnValue public final File.Builder contentRef(String contentRef)
      Initializes the optional value contentRef to contentRef.
      Parameters:
      contentRef - The value for contentRef
      Returns:
      this builder for chained invocation
    • contentRef

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the content of the file, represented as an Artifact Object.") public final File.Builder contentRef(Optional<String> contentRef)
      Initializes the optional value contentRef to contentRef.
      Parameters:
      contentRef - The value for contentRef
      Returns:
      this builder for use in a chained invocation
    • type

      @CanIgnoreReturnValue public final File.Builder type(String type)
      Initializes the value for the type attribute.
      Parameters:
      type - The value for type (can be null)
      Returns:
      this builder for use in a chained invocation
    • addExtension

      @CanIgnoreReturnValue public final File.Builder addExtension(@Nullable CyberObservableExtension element)
      Adds one element to extensions set.
      Parameters:
      element - A extensions element
      Returns:
      this builder for use in a chained invocation
    • addExtensions

      @CanIgnoreReturnValue public final File.Builder addExtensions(CyberObservableExtension... elements)
      Adds elements to extensions set.
      Parameters:
      elements - An array of extensions elements
      Returns:
      this builder for use in a chained invocation
    • extensions

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies any extensions of the object, as a dictionary.") public final File.Builder extensions(Iterable<? extends CyberObservableExtension> elements)
      Sets or replaces all elements for extensions set.
      Parameters:
      elements - An iterable of extensions elements
      Returns:
      this builder for use in a chained invocation
    • addAllExtensions

      @CanIgnoreReturnValue public final File.Builder addAllExtensions(Iterable<? extends CyberObservableExtension> elements)
      Adds elements to extensions set.
      Parameters:
      elements - An iterable of extensions elements
      Returns:
      this builder for use in a chained invocation
    • observableObjectKey

      @CanIgnoreReturnValue public final File.Builder observableObjectKey(String observableObjectKey)
      Initializes the value for the observableObjectKey attribute.

      If not set, this attribute will have a default value as returned by the initializer of observableObjectKey.

      Parameters:
      observableObjectKey - The value for observableObjectKey
      Returns:
      this builder for use in a chained invocation
    • defanged

      @CanIgnoreReturnValue public final File.Builder defanged(boolean defanged)
      Initializes the optional value defanged to defanged.
      Parameters:
      defanged - The value for defanged
      Returns:
      this builder for chained invocation
    • defanged

      @CanIgnoreReturnValue @JsonPropertyDescription("Indicates whether the data contained in the SCO has been defanged.") public final File.Builder defanged(Optional<Boolean> defanged)
      Initializes the optional value defanged to defanged.
      Parameters:
      defanged - The value for defanged
      Returns:
      this builder for use in a chained invocation
    • putCustomProperty

      @CanIgnoreReturnValue public final File.Builder putCustomProperty(String key, Object value)
      Put one entry to the customProperties map.
      Parameters:
      key - The key in the customProperties map
      value - The associated value in the customProperties map
      Returns:
      this builder for use in a chained invocation
    • putCustomProperty

      @CanIgnoreReturnValue public final File.Builder putCustomProperty(Map.Entry<String,? extends Object> entry)
      Put one entry to the customProperties map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • customProperties

      @CanIgnoreReturnValue public final File.Builder customProperties(Map<String,? extends Object> entries)
      Sets or replaces all mappings from the specified map as entries for the customProperties map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the customProperties map
      Returns:
      this builder for use in a chained invocation
    • putAllCustomProperties

      @CanIgnoreReturnValue public final File.Builder putAllCustomProperties(Map<String,? extends Object> entries)
      Put all mappings from the specified map as entries to customProperties map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the customProperties map
      Returns:
      this builder for use in a chained invocation
    • addObjectMarkingRef

      @CanIgnoreReturnValue public final File.Builder addObjectMarkingRef(@Nullable MarkingDefinitionDm element)
      Adds one element to objectMarkingRefs set.
      Parameters:
      element - A objectMarkingRefs element
      Returns:
      this builder for use in a chained invocation
    • addObjectMarkingRefs

      @CanIgnoreReturnValue public final File.Builder addObjectMarkingRefs(MarkingDefinitionDm... elements)
      Adds elements to objectMarkingRefs set.
      Parameters:
      elements - An array of objectMarkingRefs elements
      Returns:
      this builder for use in a chained invocation
    • objectMarkingRefs

      @CanIgnoreReturnValue public final File.Builder objectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements)
      Sets or replaces all elements for objectMarkingRefs set.
      Parameters:
      elements - An iterable of objectMarkingRefs elements
      Returns:
      this builder for use in a chained invocation
    • addAllObjectMarkingRefs

      @CanIgnoreReturnValue public final File.Builder addAllObjectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements)
      Adds elements to objectMarkingRefs set.
      Parameters:
      elements - An iterable of objectMarkingRefs elements
      Returns:
      this builder for use in a chained invocation
    • addGranularMarking

      @CanIgnoreReturnValue public final File.Builder addGranularMarking(@Nullable GranularMarkingDm element)
      Adds one element to granularMarkings set.
      Parameters:
      element - A granularMarkings element
      Returns:
      this builder for use in a chained invocation
    • addGranularMarkings

      @CanIgnoreReturnValue public final File.Builder addGranularMarkings(GranularMarkingDm... elements)
      Adds elements to granularMarkings set.
      Parameters:
      elements - An array of granularMarkings elements
      Returns:
      this builder for use in a chained invocation
    • granularMarkings

      @CanIgnoreReturnValue public final File.Builder granularMarkings(Iterable<? extends GranularMarkingDm> elements)
      Sets or replaces all elements for granularMarkings set.
      Parameters:
      elements - An iterable of granularMarkings elements
      Returns:
      this builder for use in a chained invocation
    • addAllGranularMarkings

      @CanIgnoreReturnValue public final File.Builder addAllGranularMarkings(Iterable<? extends GranularMarkingDm> elements)
      Adds elements to granularMarkings set.
      Parameters:
      elements - An iterable of granularMarkings elements
      Returns:
      this builder for use in a chained invocation
    • hydrated

      @CanIgnoreReturnValue public final File.Builder hydrated(boolean hydrated)
      Initializes the value for the hydrated attribute.
      Parameters:
      hydrated - The value for hydrated
      Returns:
      this builder for use in a chained invocation
    • toJsonString

      @CanIgnoreReturnValue public final File.Builder toJsonString(String toJsonString)
      Initializes the value for the toJsonString attribute.
      Parameters:
      toJsonString - The value for toJsonString (can be null)
      Returns:
      this builder for use in a chained invocation
    • build

      public File build()
      Builds a new File.
      Returns:
      An immutable instance of File
      Throws:
      IllegalStateException - if any required attributes are missing