abstract class MultiStringUpdater extends java.lang.Object
Utility class for managing string-based multi-value fields in Jira Cloud, such as Labels or custom multi-select fields.
The MultiStringUpdater prepares operations to add, remove, replace, or clear string values in a multi-value field.
It ensures that changes are tracked incrementally, allowing granular updates.
Issues.getByKey("TEST-123").update {
setLabels {
add("new-label-1", "new-label-2") // Add new labels
remove("old-label-1") // Remove a specific label
replace("temp-label", "final-label") // Replace an existing label
}
}
Clearing all labels:
Issues.getByKey("TEST-123").update {
setLabels {
clear() // Removes all labels from the issue
}
}
Replacing all existing labels:
Issues.getByKey("TEST-123").update {
setLabels {
set("final-label-1", "final-label-2")
}
}
[
[add: "new-label-1"],
[add: "new-label-2"],
[remove: "old-label-1"],
[remove: "temp-label"],
[add: "final-label"]
]
Notes:
| Modifiers | Name | Description |
|---|---|---|
protected java.util.List<java.util.Map> |
operations |
| Constructor and description |
|---|
MultiStringUpdater(java.util.List<java.lang.String> items)Creates a new MultiStringUpdater with the current field values. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
add(java.lang.String[] items)Adds one or more string values to the field. |
|
void |
clear()Clears all values from the field. |
|
java.util.List |
get()Retrieves the list of operations to be applied to the field. |
|
void |
remove(java.lang.String[] items)Removes one or more string values from the field. |
|
void |
replace(java.lang.String oldItem, java.lang.String newItem)Replaces an existing string value with a new value, if the old value exists. |
|
void |
set(java.lang.String[] items)Replaces all values in the field with the specified string values. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Creates a new MultiStringUpdater with the current field values.
items - the existing items in the fieldAdds one or more string values to the field.
items - the string values to addClears all values from the field.
Retrieves the list of operations to be applied to the field.
Removes one or more string values from the field.
items - the string values to removeReplaces an existing string value with a new value, if the old value exists.
oldItem - the value to be replacednewItem - the new value to addReplaces all values in the field with the specified string values.
items - the string values to set