Class MarkingDefinition.Builder
java.lang.Object
security.whisper.javastix.datamarkings.MarkingDefinition.Builder
- Enclosing class:
MarkingDefinition
Builds instances of type
MarkingDefinition.
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 Summary
Modifier and TypeMethodDescriptionaddAllExternalReferences(Iterable<? extends ExternalReferenceType> elements) Adds elements toexternalReferencesset.addAllGranularMarkings(Iterable<? extends GranularMarkingDm> elements) Adds elements togranularMarkingsset.addAllObjectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements) Adds elements toobjectMarkingRefsset.Adds one element toexternalReferencesset.addExternalReferences(ExternalReferenceType... elements) Adds elements toexternalReferencesset.addGranularMarking(GranularMarkingDm element) Adds one element togranularMarkingsset.addGranularMarkings(GranularMarkingDm... elements) Adds elements togranularMarkingsset.addObjectMarkingRef(MarkingDefinitionDm element) Adds one element toobjectMarkingRefsset.addObjectMarkingRefs(MarkingDefinitionDm... elements) Adds elements toobjectMarkingRefsset.build()Builds a newMarkingDefinition.created(StixInstant created) Initializes the value for thecreatedattribute.createdByRef(Optional<? extends IdentitySdo> createdByRef) Initializes the optional valuecreatedByRefto createdByRef.createdByRef(IdentitySdo createdByRef) Initializes the optional valuecreatedByRefto createdByRef.customProperties(Map<String, ? extends Object> entries) Sets or replaces all mappings from the specified map as entries for thecustomPropertiesmap.definition(StixMarkingObject definition) Initializes the value for thedefinitionattribute.definitionType(String definitionType) Initializes the value for thedefinitionTypeattribute.externalReferences(Iterable<? extends ExternalReferenceType> elements) Sets or replaces all elements forexternalReferencesset.from(BundleableObject instance) Fill a builder with attribute values from the providedsecurity.whisper.javastix.bundle.BundleableObjectinstance.from(StixCommonProperties instance) Fill a builder with attribute values from the providedsecurity.whisper.javastix.common.StixCommonPropertiesinstance.from(StixCustomProperties instance) Fill a builder with attribute values from the providedsecurity.whisper.javastix.common.StixCustomPropertiesinstance.from(MarkingDefinitionDm instance) Fill a builder with attribute values from the providedsecurity.whisper.javastix.datamarkings.MarkingDefinitionDminstance.granularMarkings(Iterable<? extends GranularMarkingDm> elements) Sets or replaces all elements forgranularMarkingsset.hydrated(boolean hydrated) Initializes the value for thehydratedattribute.Initializes the value for theidattribute.Initializes the optional valuelangto lang.Initializes the optional valuelangto lang.objectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements) Sets or replaces all elements forobjectMarkingRefsset.putAllCustomProperties(Map<String, ? extends Object> entries) Put all mappings from the specified map as entries tocustomPropertiesmap.putCustomProperty(String key, Object value) Put one entry to thecustomPropertiesmap.putCustomProperty(Map.Entry<String, ? extends Object> entry) Put one entry to thecustomPropertiesmap.Initializes the value for thetypeattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedsecurity.whisper.javastix.datamarkings.MarkingDefinitionDminstance.- 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.bundle.BundleableObjectinstance.- 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.StixCommonPropertiesinstance.- 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
-
definitionType
Initializes the value for thedefinitionTypeattribute.- Parameters:
definitionType- The value for definitionType (can benull)- Returns:
thisbuilder for use in a chained invocation
-
definition
@CanIgnoreReturnValue public final MarkingDefinition.Builder definition(StixMarkingObject definition) Initializes the value for thedefinitionattribute.- Parameters:
definition- The value for definition (can benull)- Returns:
thisbuilder for use in a chained invocation
-
hydrated
Initializes the value for thehydratedattribute.If not set, this attribute will have a default value as returned by the initializer of
hydrated.- Parameters:
hydrated- The value for hydrated- 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 MarkingDefinition.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 MarkingDefinition.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
-
createdByRef
Initializes the optional valuecreatedByRefto createdByRef.- Parameters:
createdByRef- The value for createdByRef- Returns:
thisbuilder for chained invocation
-
createdByRef
@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 MarkingDefinition.Builder createdByRef(Optional<? extends IdentitySdo> createdByRef) Initializes the optional valuecreatedByRefto createdByRef.- Parameters:
createdByRef- The value for createdByRef- Returns:
thisbuilder for use in a chained invocation
-
created
@CanIgnoreReturnValue @JsonPropertyDescription("The created property represents the time at which the first version of this object was created. The timstamp value MUST be precise to the nearest millisecond.") public final MarkingDefinition.Builder created(StixInstant created) Initializes the value for thecreatedattribute.If not set, this attribute will have a default value as returned by the initializer of
created.- Parameters:
created- The value for created- Returns:
thisbuilder for use in a chained invocation
-
lang
Initializes the optional valuelangto lang.- Parameters:
lang- The value for lang- Returns:
thisbuilder for chained invocation
-
lang
@CanIgnoreReturnValue @JsonPropertyDescription("Identifies the language of the text content in this object using ISO 639-2 language codes.") public final MarkingDefinition.Builder lang(Optional<String> lang) Initializes the optional valuelangto lang.- Parameters:
lang- The value for lang- Returns:
thisbuilder for use in a chained invocation
-
addExternalReference
@CanIgnoreReturnValue public final MarkingDefinition.Builder addExternalReference(@Nullable ExternalReferenceType element) Adds one element toexternalReferencesset.- Parameters:
element- A externalReferences element- Returns:
thisbuilder for use in a chained invocation
-
addExternalReferences
@CanIgnoreReturnValue public final MarkingDefinition.Builder addExternalReferences(ExternalReferenceType... elements) Adds elements toexternalReferencesset.- Parameters:
elements- An array of externalReferences elements- Returns:
thisbuilder for use in a chained invocation
-
externalReferences
@CanIgnoreReturnValue @JsonPropertyDescription("A list of external references which refers to non-STIX information.") public final MarkingDefinition.Builder externalReferences(Iterable<? extends ExternalReferenceType> elements) Sets or replaces all elements forexternalReferencesset.- Parameters:
elements- An iterable of externalReferences elements- Returns:
thisbuilder for use in a chained invocation
-
addAllExternalReferences
@CanIgnoreReturnValue public final MarkingDefinition.Builder addAllExternalReferences(Iterable<? extends ExternalReferenceType> elements) Adds elements toexternalReferencesset.- Parameters:
elements- An iterable of externalReferences elements- Returns:
thisbuilder for use in a chained invocation
-
addObjectMarkingRef
@CanIgnoreReturnValue public final MarkingDefinition.Builder addObjectMarkingRef(@Nullable MarkingDefinitionDm element) Adds one element toobjectMarkingRefsset.- Parameters:
element- A objectMarkingRefs element- Returns:
thisbuilder for use in a chained invocation
-
addObjectMarkingRefs
@CanIgnoreReturnValue public final MarkingDefinition.Builder addObjectMarkingRefs(MarkingDefinitionDm... elements) Adds elements toobjectMarkingRefsset.- Parameters:
elements- An array of objectMarkingRefs elements- Returns:
thisbuilder for use in a chained invocation
-
objectMarkingRefs
@CanIgnoreReturnValue @JsonPropertyDescription("The list of marking-definition objects to be applied to this object.") public final MarkingDefinition.Builder objectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements) Sets or replaces all elements forobjectMarkingRefsset.- Parameters:
elements- An iterable of objectMarkingRefs elements- Returns:
thisbuilder for use in a chained invocation
-
addAllObjectMarkingRefs
@CanIgnoreReturnValue public final MarkingDefinition.Builder addAllObjectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements) Adds elements toobjectMarkingRefsset.- Parameters:
elements- An iterable of objectMarkingRefs elements- Returns:
thisbuilder for use in a chained invocation
-
addGranularMarking
@CanIgnoreReturnValue public final MarkingDefinition.Builder addGranularMarking(@Nullable GranularMarkingDm element) Adds one element togranularMarkingsset.- Parameters:
element- A granularMarkings element- Returns:
thisbuilder for use in a chained invocation
-
addGranularMarkings
@CanIgnoreReturnValue public final MarkingDefinition.Builder addGranularMarkings(GranularMarkingDm... elements) Adds elements togranularMarkingsset.- Parameters:
elements- An array of granularMarkings elements- Returns:
thisbuilder for use in a chained invocation
-
granularMarkings
@CanIgnoreReturnValue @JsonPropertyDescription("The set of granular markings that apply to this object.") public final MarkingDefinition.Builder granularMarkings(Iterable<? extends GranularMarkingDm> elements) Sets or replaces all elements forgranularMarkingsset.- Parameters:
elements- An iterable of granularMarkings elements- Returns:
thisbuilder for use in a chained invocation
-
addAllGranularMarkings
@CanIgnoreReturnValue public final MarkingDefinition.Builder addAllGranularMarkings(Iterable<? extends GranularMarkingDm> elements) Adds elements togranularMarkingsset.- Parameters:
elements- An iterable of granularMarkings elements- Returns:
thisbuilder for use in a chained invocation
-
putCustomProperty
@CanIgnoreReturnValue public final MarkingDefinition.Builder putCustomProperty(String key, Object value) 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 MarkingDefinition.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 MarkingDefinition.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 MarkingDefinition.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 newMarkingDefinition.- Returns:
- An immutable instance of MarkingDefinition
- Throws:
IllegalStateException- if any required attributes are missing
-