Class ExternalReference.Builder

java.lang.Object
security.whisper.javastix.sdo.types.ExternalReference.Builder
Enclosing class:
ExternalReference

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

      @CanIgnoreReturnValue @JsonPropertyDescription("The source within which the external-reference is defined (system, registry, organization, etc.)") public final ExternalReference.Builder sourceName(String sourceName)
      Initializes the value for the sourceName attribute.
      Parameters:
      sourceName - The value for sourceName (can be null)
      Returns:
      this builder for use in a chained invocation
    • description

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

      @CanIgnoreReturnValue @JsonPropertyDescription("A human readable description") public final ExternalReference.Builder description(Optional<String> description)
      Initializes the optional value description to description.
      Parameters:
      description - The value for description
      Returns:
      this builder for use in a chained invocation
    • url

      @CanIgnoreReturnValue public final ExternalReference.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("Matches the elements of a URL using a regular expression. Uses Diego Perini\'s regex from https://gist.github.com/dperini/729294.") public final ExternalReference.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 ExternalReference.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 ExternalReference.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 file.") public final ExternalReference.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 ExternalReference.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
    • externalId

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

      @CanIgnoreReturnValue @JsonPropertyDescription("An identifier for the external reference content") public final ExternalReference.Builder externalId(Optional<String> externalId)
      Initializes the optional value externalId to externalId.
      Parameters:
      externalId - The value for externalId
      Returns:
      this builder for use in a chained invocation
    • putCustomProperty

      @CanIgnoreReturnValue public final ExternalReference.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 ExternalReference.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 ExternalReference.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 ExternalReference.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
    • build

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