@ParametersAreNonnullByDefault public class CachedOptionSetManager extends Object implements OptionSetManager
Constructor and Description |
---|
CachedOptionSetManager(OptionSetManagerImpl delegate,
com.atlassian.cache.CacheManager cacheManager) |
Modifier and Type | Method and Description |
---|---|
OptionSet |
addOptionToOptionSet(FieldConfig config,
String optionId)
Adds a new option to the option set.
|
OptionSet |
createOptionSet(FieldConfig config,
Collection<String> optionIds)
Creates a new option set or replaces an existing one.
|
OptionSet |
getOptionsForConfig(FieldConfig config)
Retrieves an option set that contains the options for the given field configuration.
|
void |
onClearCache(ClearCacheEvent event) |
OptionSet |
removeOptionFromOptionSet(FieldConfig config,
String optionId)
Removes an option from the option set.
|
void |
removeOptionSet(FieldConfig config)
Removes all options from this field configuration.
|
OptionSet |
updateOptionSet(FieldConfig config,
Collection<String> optionIds)
Creates a new option set or replaces an existing one.
|
public CachedOptionSetManager(OptionSetManagerImpl delegate, com.atlassian.cache.CacheManager cacheManager)
@EventListener public void onClearCache(ClearCacheEvent event)
@Nonnull public OptionSet getOptionsForConfig(FieldConfig config)
OptionSetManager
getOptionsForConfig
in interface OptionSetManager
config
- the field configuration whose options are to be retrieved@Nonnull public OptionSet createOptionSet(FieldConfig config, Collection<String> optionIds)
OptionSetManager
Well... maybe. For historic reasons, a null
value is tolerated for optionIds
and is treated
the same as calling OptionSetManager.removeOptionSet(FieldConfig)
. It is now annotated with @Nonnull
to warn
callers that this should be avoided. Please call OptionSetManager.removeOptionSet(FieldConfig)
if that's what you
really mean!
By the way, this method and OptionSetManager.updateOptionSet(FieldConfig, Collection)
do exactly
the same thing. Don't ask me why we have both of them; I'm sure it seemed like a great idea at the time.
createOptionSet
in interface OptionSetManager
config
- the field configuration associated with the option setoptionIds
- the collection of options to include. The options will be ordered by the iteration order
of the collection, so it should be a List
or SortedSet
if you want the
results to be predictable.@Nonnull public OptionSet updateOptionSet(FieldConfig config, Collection<String> optionIds)
OptionSetManager
Well... maybe. For historic reasons, a null
value is tolerated for optionIds
and is treated
the same as calling OptionSetManager.removeOptionSet(FieldConfig)
. It is now annotated with @Nonnull
to warn
callers that this should be avoided. Please call OptionSetManager.removeOptionSet(FieldConfig)
if that's what you
really mean!
By the way, this method and OptionSetManager.createOptionSet(FieldConfig, Collection)
do exactly
the same thing. Don't ask me why we have both of them; I'm sure it seemed like a great idea at the time.
updateOptionSet
in interface OptionSetManager
config
- the field configuration associated with the option setoptionIds
- the collection of options to include. The options will be ordered by the iteration order
of the collection, so it should be a List
or SortedSet
if you want the
results to be predictable.public OptionSet addOptionToOptionSet(FieldConfig config, String optionId)
OptionSetManager
addOptionToOptionSet
in interface OptionSetManager
config
- the field configuration associated with the option setoptionId
- to add to the option setpublic OptionSet removeOptionFromOptionSet(FieldConfig config, String optionId)
OptionSetManager
removeOptionFromOptionSet
in interface OptionSetManager
config
- the field configuration associated with the option setoptionId
- to remove from the option setpublic void removeOptionSet(FieldConfig config)
OptionSetManager
removeOptionSet
in interface OptionSetManager
config
- the field configuration to destroyCopyright © 2002-2022 Atlassian. All Rights Reserved.