Package security.whisper.javastix.bundle
Class Bundle.Builder
java.lang.Object
security.whisper.javastix.bundle.Bundle.Builder
- Enclosing class:
Bundle
-
Method Summary
Modifier and TypeMethodDescriptionfinal Bundle.BuilderaddAllObjects(Iterable<? extends BundleableObject> elements) Adds elements toobjectsset.final Bundle.BuilderaddObject(BundleableObject element) Adds one element toobjectsset.final Bundle.BuilderaddObjects(BundleableObject... elements) Adds elements toobjectsset.build()Builds a newBundle.final Bundle.BuildercustomProperties(Map<String, ? extends Object> entries) Sets or replaces all mappings from the specified map as entries for thecustomPropertiesmap.final Bundle.Builderfrom(BundleObject instance) Fill a builder with attribute values from the providedsecurity.whisper.javastix.bundle.BundleObjectinstance.final Bundle.Builderfrom(StixCustomProperties instance) Fill a builder with attribute values from the providedsecurity.whisper.javastix.common.StixCustomPropertiesinstance.final Bundle.BuilderInitializes the value for theidattribute.final Bundle.Builderobjects(Iterable<? extends BundleableObject> elements) Sets or replaces all elements forobjectsset.final Bundle.BuilderputAllCustomProperties(Map<String, ? extends Object> entries) Put all mappings from the specified map as entries tocustomPropertiesmap.final Bundle.BuilderputCustomProperty(String key, Object value) Put one entry to thecustomPropertiesmap.final Bundle.BuilderputCustomProperty(Map.Entry<String, ? extends Object> entry) Put one entry to thecustomPropertiesmap.final Bundle.BuilderspecVersion(String specVersion) Initializes the value for thespecVersionattribute.final Bundle.BuilderInitializes the value for thetypeattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedsecurity.whisper.javastix.bundle.BundleObjectinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
Fill a builder with attribute values from the providedsecurity.whisper.javastix.common.StixCustomPropertiesinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
type
@CanIgnoreReturnValue @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 final Bundle.Builder type(String type) Initializes the value for thetypeattribute.- Parameters:
type- The value for type (can benull)- Returns:
thisbuilder for use in a chained invocation
-
id
@CanIgnoreReturnValue @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 final Bundle.Builder id(String id) Initializes the value for theidattribute.- Parameters:
id- The value for id (can benull)- Returns:
thisbuilder for use in a chained invocation
-
specVersion
@CanIgnoreReturnValue @JsonPropertyDescription("The version of the STIX specification used to represent the content in this bundle.") public final Bundle.Builder specVersion(String specVersion) Initializes the value for thespecVersionattribute.If not set, this attribute will have a default value as returned by the initializer of
specVersion.- Parameters:
specVersion- The value for specVersion- Returns:
thisbuilder for use in a chained invocation
-
addObject
Adds one element toobjectsset.- Parameters:
element- A objects element- Returns:
thisbuilder for use in a chained invocation
-
addObjects
Adds elements toobjectsset.- Parameters:
elements- An array of objects elements- Returns:
thisbuilder for use in a chained invocation
-
objects
@CanIgnoreReturnValue @JsonPropertyDescription("Specifies a set of one or more STIX Objects.") public final Bundle.Builder objects(Iterable<? extends BundleableObject> elements) Sets or replaces all elements forobjectsset.- Parameters:
elements- An iterable of objects elements- Returns:
thisbuilder for use in a chained invocation
-
addAllObjects
@CanIgnoreReturnValue public final Bundle.Builder addAllObjects(Iterable<? extends BundleableObject> elements) Adds elements toobjectsset.- Parameters:
elements- An iterable of objects elements- Returns:
thisbuilder for use in a chained invocation
-
putCustomProperty
Put one entry to thecustomPropertiesmap.- Parameters:
key- The key in the customProperties mapvalue- The associated value in the customProperties map- Returns:
thisbuilder for use in a chained invocation
-
putCustomProperty
@CanIgnoreReturnValue public final Bundle.Builder putCustomProperty(Map.Entry<String, ? extends Object> entry) Put one entry to thecustomPropertiesmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
customProperties
@CanIgnoreReturnValue public final Bundle.Builder customProperties(Map<String, ? extends Object> entries) Sets or replaces all mappings from the specified map as entries for thecustomPropertiesmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the customProperties map- Returns:
thisbuilder for use in a chained invocation
-
putAllCustomProperties
@CanIgnoreReturnValue public final Bundle.Builder putAllCustomProperties(Map<String, ? extends Object> entries) Put all mappings from the specified map as entries tocustomPropertiesmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the customProperties map- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newBundle.- Returns:
- An immutable instance of BundleObject
- Throws:
IllegalStateException- if any required attributes are missing
-