public class CodeLists extends Object
A code list is referenced by its unique name (code) and can be used to map codes to user defined texts. Additionally a second values (additionalValue) can be stored per code.
The required data is stored via CodeList
and CodeListEntry
. The CodeListController
is used
to provide an administration GUI for the user.
Modifier and Type | Field and Description |
---|---|
static String |
FRAMEWORK_CODE_LISTS
Names the framework which must be enabled to activate the code lists feature.
|
Constructor and Description |
---|
CodeLists() |
Modifier and Type | Method and Description |
---|---|
List<CodeListEntry> |
getEntries(String codeList)
Returns all entries of a code list.
|
String |
getRequiredValue(String codeList,
String code)
Returns the value from the given code list associated with the given code or throws an exception if no matching
entry exists.
|
String |
getValue(String codeList,
String code)
Returns the value from the given code list associated with the given code.
|
sirius.kernel.commons.Tuple<String,String> |
getValues(String codeList,
String code)
Returns the value and the additionalValue associated with the given code.
|
boolean |
hasValue(String codeList,
String code)
Determines if the code list contains the given code.
|
public static final String FRAMEWORK_CODE_LISTS
@Nullable public String getValue(@Nonnull String codeList, @Nullable String code)
If no matching entry exists, the code itself will be returned.
codeList
- the code list to search incode
- the code to lookuppublic boolean hasValue(@Nonnull String codeList, @Nullable String code)
codeList
- the code list to search incode
- the code to checkpublic String getRequiredValue(@Nonnull String codeList, @Nonnull String code)
codeList
- the code list to search incode
- the code to lookupsirius.kernel.health.HandledException
- if no entry exists for the given codepublic sirius.kernel.commons.Tuple<String,String> getValues(@Nonnull String codeList, @Nonnull String code)
If no matching entry exists, the code itself will be returned as value and the additional value (the second of the tuple) will be null.
codeList
- the code list to search incode
- the code to lookuppublic List<CodeListEntry> getEntries(@Nonnull String codeList)
codeList
- the code list to fetch entries fromCopyright © 2018. All rights reserved.