Interface OptionSetManager

All Known Implementing Classes:
CachedOptionSetManager, OptionSetManagerImpl

@ParametersAreNonnullByDefault @PublicApi public interface OptionSetManager
Manipulates the options associated with a field configuration.
  • Method Details

    • getOptionsForConfig

      @Nonnull OptionSet getOptionsForConfig(FieldConfig config)
      Retrieves an option set that contains the options for the given field configuration.
      Parameters:
      config - the field configuration whose options are to be retrieved
      Returns:
      an option set containing the options for that field configuration
    • createOptionSet

      @Nonnull OptionSet createOptionSet(FieldConfig config, Collection<String> optionIds)
      Creates a new option set or replaces an existing one.

      Well... maybe. For historic reasons, a null value is tolerated for optionIds and is treated the same as calling removeOptionSet(FieldConfig). It is now annotated with @Nonnull to warn callers that this should be avoided. Please call removeOptionSet(FieldConfig) if that's what you really mean!

      By the way, this method and 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.

      Parameters:
      config - the field configuration associated with the option set
      optionIds - 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.
      Returns:
      the set of options assigned to this field configuration
    • updateOptionSet

      @Nonnull OptionSet updateOptionSet(FieldConfig config, Collection<String> optionIds)
      Creates a new option set or replaces an existing one.

      Well... maybe. For historic reasons, a null value is tolerated for optionIds and is treated the same as calling removeOptionSet(FieldConfig). It is now annotated with @Nonnull to warn callers that this should be avoided. Please call removeOptionSet(FieldConfig) if that's what you really mean!

      By the way, this method and 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.

      Parameters:
      config - the field configuration associated with the option set
      optionIds - 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.
      Returns:
      the set of options assigned to this field configuration
    • addOptionToOptionSet

      @Nonnull OptionSet addOptionToOptionSet(FieldConfig config, String optionId)
      Adds a new option to the option set. This will be placed in the last position of the set (highest sequence).
      Parameters:
      config - the field configuration associated with the option set
      optionId - to add to the option set
      Returns:
      the set of options assigned to this field configuration
    • removeOptionFromOptionSet

      @Nonnull OptionSet removeOptionFromOptionSet(FieldConfig config, String optionId)
      Removes an option from the option set.
      Parameters:
      config - the field configuration associated with the option set
      optionId - to remove from the option set
      Returns:
      the set of options assigned to this field configuration
    • removeOptionSet

      void removeOptionSet(FieldConfig config)
      Removes all options from this field configuration.
      Parameters:
      config - the field configuration to destroy