Interface IEnumeration<T extends IEnumOption>

All Known Subinterfaces:
IConfigurableEnumeration<T>, IObjectEnumeration, IPriorityEnumeration
All Known Implementing Classes:
AbstractEnumeration, AbstractObjectEnumeration, RepoBasedEnumeration, TypedEnumeration

public interface IEnumeration<T extends IEnumOption>
  • Method Details

    • wrapOption

      T wrapOption(String optionId)
      Wraps any given ID into a valid option of this enumeration.

      This is needed to correctly handle any values coming e.g. from the storage.

      This method checks all the option definitions for all controlValues and returns the correct value if it appears in any of them. If no definition is found, then phantom option is created.

      Parameters:
      optionId - option id (not null)
      Returns:
      the option wrapped as an IEnumOption (not null)
    • wrapOption

      T wrapOption(String optionId, Object controlValue)
      Wraps any given ID into a valid option of this enumeration.

      This method checks only the option definition for given controlValue (even if null). If no definition is found, then phantom option is created.

      Parameters:
      optionId - option id (not null)
      controlValue - control value
      Returns:
      the option wrapped as an IEnumOption (not null)
      Since:
      3.1.1
      See Also:
    • wrapOption

      T wrapOption(String optionId, IPObject pobject)
      Wraps any given ID into a valid option of this enumeration.

      This method checks only the option definition applicable to given object. If no definition is found, then phantom option is created.

      If pobject is not specified then it acts as wrapOption(String, Object) with null control value.

      Parameters:
      optionId - option id (not null)
      pobject - persistence object
      Returns:
      the option wrapped as an IEnumOption (not null)
      Since:
      3.1.1
      See Also:
    • getAvailableOptions

      List<T> getAvailableOptions(Object controlValue)
      Currently, the control value can be only String or IEnumOption. Passing in something else will result in UnsupportedOperationException

      Parameters:
      controlValue - Can be null.
      Returns:
      Sorted list of all the valid options for given control key value.
    • getControlKey

      String getControlKey()
      Returns:
      Name of the key on the object, which controls the option set of this enumeration.
    • getAllOptions

      List<T> getAllOptions()
      Returns:
      Sorted list of all IEnumOptions across all the control key values.
    • getAvailableOptions

      List<T> getAvailableOptions(Object controlValue, IEnumOption currentValue)
      Currently, the control value can be only String or IEnumOption. Passing in something else will result in UnsupportedOperationException.

      Parameters:
      controlValue -
      currentValue -
      Returns:
      Sorted list of IEnumOptions, containing all the values returned by getAvailableOptions(Object) plus the currentValue option.
    • getDefaultOption

      T getDefaultOption(Object controlValue)
      Parameters:
      controlValue - The control value, since the default value might depend on it.
      Returns:
      the default option from the enumeration