Class Artifact.Builder

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

@NotThreadSafe public static final class Artifact.Builder extends Object
Builds instances of type Artifact. 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 Artifact.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 Artifact.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 Artifact.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 Artifact.Builder from(ArtifactCoo instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.coo.objects.ArtifactCoo instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • mimeType

      @CanIgnoreReturnValue public final Artifact.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("The value of this property MUST be a valid MIME type as specified in the IANA Media Types registry.") public final Artifact.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
    • payloadBin

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

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the binary data contained in the artifact as a base64-encoded string.") public final Artifact.Builder payloadBin(Optional<String> payloadBin)
      Initializes the optional value payloadBin to payloadBin.
      Parameters:
      payloadBin - The value for payloadBin
      Returns:
      this builder for use in a chained invocation
    • url

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

      @CanIgnoreReturnValue @JsonPropertyDescription("The value of this property MUST be a valid URL that resolves to the unencoded content.") public final Artifact.Builder url(Optional<String> url)
      Initializes the optional value url to url.
      Parameters:
      url - The value for url
      Returns:
      this builder for use in a chained invocation
    • putHash

      @CanIgnoreReturnValue public final Artifact.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 Artifact.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 url or the payload_bin.") public final Artifact.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 Artifact.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
    • type

      @CanIgnoreReturnValue public final Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact.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 Artifact build()
      Builds a new Artifact.
      Returns:
      An immutable instance of Artifact
      Throws:
      IllegalStateException - if any required attributes are missing