class MultiOptionNameUpdater extends java.lang.Object
Utility class for managing multi-option fields in Jira Cloud, such as Components, Versions, or Labels.
The MultiOptionNameUpdater prepares operations to add, remove, replace, or clear options in multi-option fields.
It supports operations using both option names and IDs.
Note: Adding an option does not create new entries; the specified options must already exist in Jira.
Issues.getByKey("TEST-123").update {
setComponents {
remove(1001L, 1002L) // Removes Components with IDs 1001 and 1002
}
}
To add or set Components by their names:
Issues.getByKey("TEST-123").update {
setComponents {
add("Backend Module", "Frontend Module")
set("Core Module", "API Module") // Replaces all Components with the specified ones
}
}
Clearing all components:
Issues.getByKey("TEST-123").update {
setComponents {
clear() // Removes all Components from the issue
}
}
[
[remove: [id: "1001"]],
[remove: [id: "1002"]],
[add: [name: "Backend Module"]],
[set: [[name: "Core Module"], [name: "API Module"]]],
[set: []]
]
| Modifiers | Name | Description |
|---|---|---|
protected java.util.List<java.util.Map> |
operations |
A list of operations to be applied to the multi-option field. |
| Constructor and description |
|---|
MultiOptionNameUpdater() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
add(java.lang.String[] items)Adds existing options to the field using their names. |
|
void |
add(java.lang.Long[] items)Adds existing options to the field using their IDs. |
|
void |
clear()Clears all options from the field. |
|
java.util.List<java.util.Map> |
get()Retrieves the list of operations to be applied to the multi-option field. |
|
void |
remove(java.lang.String[] items)Removes options from the field using their names. |
|
void |
remove(java.lang.Long[] items)Removes options from the field using their IDs. |
|
void |
set(java.lang.String[] items)Replaces all options in the field with the specified names. |
|
void |
set(java.lang.Long[] items)Replaces all options in the field with the specified IDs. |
| 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) |
A list of operations to be applied to the multi-option field.
Adds existing options to the field using their names.
items - one or more option names to addAdds existing options to the field using their IDs.
items - one or more option IDs to addClears all options from the field.
Retrieves the list of operations to be applied to the multi-option field.
Removes options from the field using their names.
items - one or more option names to removeRemoves options from the field using their IDs.
items - one or more option IDs to removeReplaces all options in the field with the specified names.
items - one or more option names to setReplaces all options in the field with the specified IDs.
items - one or more option IDs to set