Class AbstractEnumeration
java.lang.Object
com.polarion.platform.persistence.spi.AbstractEnumeration
- All Implemented Interfaces:
IEnumeration
- Direct Known Subclasses:
RepoBasedEnumeration
Abstract implementation of an enum factory.
- Author:
- POLARION SOFTWARE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAvailableOptions(Object controlValue) Currently, the control value can be onlyStringorIEnumOption.getAvailableOptions(Object controlValue, IEnumOption currentValue) Currently, the control value can be onlyStringorIEnumOption.Default impl returnsnull.getDefaultOption(Object controlValue) abstract IEnumOptiongetDefaultOption(String controlValue) wrapOption(String optionId) Wraps any given ID into a valid option of this enumeration.wrapOption(String optionId, IPObject pobject) Wraps any given ID into a valid option of this enumeration.wrapOption(String optionId, Object controlValue) Wraps any given ID into a valid option of this enumeration.
-
Constructor Details
-
AbstractEnumeration
-
-
Method Details
-
getAllOptions
- Specified by:
getAllOptionsin interfaceIEnumeration- Returns:
- Sorted list of all IEnumOptions across all the control key values.
-
getAvailableOptions
Description copied from interface:IEnumerationCurrently, the control value can be onlyStringorIEnumOption. Passing in something else will result inUnsupportedOperationException- Specified by:
getAvailableOptionsin interfaceIEnumeration- Parameters:
controlValue- Can benull.- Returns:
- Sorted list of all the valid options for given control key value.
-
getAvailableOptions
Description copied from interface:IEnumerationCurrently, the control value can be onlyStringorIEnumOption. Passing in something else will result inUnsupportedOperationException.- Specified by:
getAvailableOptionsin interfaceIEnumeration- Returns:
- Sorted list of IEnumOptions, containing all the values returned by
IEnumeration.getAvailableOptions(Object)plus thecurrentValueoption.
-
getControlKey
Default impl returnsnull. Override if necessary.- Specified by:
getControlKeyin interfaceIEnumeration- Returns:
- Name of the key on the object, which controls the option set of this enumeration.
-
getDefaultOption
- Specified by:
getDefaultOptionin interfaceIEnumeration- Parameters:
controlValue- The control value, since the default value might depend on it.- Returns:
- the default option from the enumeration
-
getDefaultOption
-
wrapOption
Description copied from interface:IEnumerationWraps 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.
- Specified by:
wrapOptionin interfaceIEnumeration- Parameters:
optionId- option id (notnull)- Returns:
- the option wrapped as an
IEnumOption(notnull)
-
wrapOption
Description copied from interface:IEnumerationWraps 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.- Specified by:
wrapOptionin interfaceIEnumeration- Parameters:
optionId- option id (notnull)controlValue- control value- Returns:
- the option wrapped as an
IEnumOption(notnull) - See Also:
-
wrapOption
Description copied from interface:IEnumerationWraps 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
IEnumeration.wrapOption(String, Object)withnullcontrol value.- Specified by:
wrapOptionin interfaceIEnumeration- Parameters:
optionId- option id (notnull)pobject- persistence object- Returns:
- the option wrapped as an
IEnumOption(notnull) - See Also:
-