Class Bundle

java.lang.Object
security.whisper.javastix.bundle.Bundle
All Implemented Interfaces:
Serializable, BundleObject, Stix, StixCustomProperties, GenericValidation, SdoDefaultValidator

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class Bundle extends Object implements BundleObject
Immutable implementation of BundleObject.

Use the builder to create immutable instances: Bundle.builder().

See Also:
  • Method Details

    • getType

      @JsonPropertyDescription("The type property identifies the type of STIX Object (SDO, Relationship Object, etc). The value of the type field MUST be one of the types defined by a STIX Object (e.g., indicator).") public String getType()
      Specified by:
      getType in interface BundleObject
      Returns:
      The value of the type attribute
    • getId

      @JsonPropertyDescription("Represents identifiers across the CTI specifications. The format consists of the name of the top-level object being identified, followed by two dashes (--), followed by a UUIDv4.") public String getId()
      Specified by:
      getId in interface BundleObject
      Returns:
      The value of the id attribute
    • getSpecVersion

      @JsonPropertyDescription("The version of the STIX specification used to represent the content in this bundle.") public String getSpecVersion()
      Specified by:
      getSpecVersion in interface BundleObject
      Returns:
      The value of the specVersion attribute
    • getObjects

      @JsonPropertyDescription("Specifies a set of one or more STIX Objects.") public com.google.common.collect.ImmutableSet<BundleableObject> getObjects()
      Specified by:
      getObjects in interface BundleObject
      Returns:
      The value of the objects attribute
    • getCustomProperties

      public com.google.common.collect.ImmutableMap<String,Object> getCustomProperties()
      Custom Properties for STIX Objects. Any object that supports custom properties will have a validation of the custom property prefix (typically "x_"). If the additional property in the JSON does not meet the StartsWith condition, then the JSON will be rejected.
      Specified by:
      getCustomProperties in interface StixCustomProperties
      Returns:
      Map of custom properties Map<String, Object>
    • withType

      public final Bundle withType(String value)
      Copy the current immutable object by setting a value for the type attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type (can be null)
      Returns:
      A modified copy of the this object
    • withId

      public final Bundle withId(String value)
      Copy the current immutable object by setting a value for the id attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for id (can be null)
      Returns:
      A modified copy of the this object
    • withSpecVersion

      public final Bundle withSpecVersion(String value)
      Copy the current immutable object by setting a value for the specVersion attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for specVersion
      Returns:
      A modified copy of the this object
    • withObjects

      public final Bundle withObjects(BundleableObject... elements)
      Copy the current immutable object with elements that replace the content of objects.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withObjects

      public final Bundle withObjects(Iterable<? extends BundleableObject> elements)
      Copy the current immutable object with elements that replace the content of objects. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of objects elements to set
      Returns:
      A modified copy of this object
    • withCustomProperties

      public final Bundle withCustomProperties(Map<String,? extends Object> entries)
      Copy the current immutable object by replacing the customProperties map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the customProperties map
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of Bundle that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: type, id, specVersion, objects, customProperties.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value BundleObject with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • toJsonString

      public String toJsonString()

      Returns a lazily initialized value of the toJsonString attribute. Initialized once and only once and stored for subsequent access with proper synchronization.

      Specified by:
      toJsonString in interface BundleObject
      Returns:
      A lazily initialized value of the toJsonString attribute
    • copyOf

      public static Bundle copyOf(BundleObject instance)
      Creates an immutable copy of a BundleObject value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable BundleObject instance
    • builder

      public static Bundle.Builder builder()
      Creates a builder for Bundle.
      Returns:
      A new Bundle builder