Class EnumUtils
java.lang.Object
io.jmix.core.metamodel.datatype.impl.EnumUtils
A helper class to be used in
EnumClass
implementations to convert identifiers to enum values.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns an enum value for the given id.Returns an enum value for the given id.fromIdSafe
(Class<T> e, V id, T defaultValue) Returns an enum value for the given id, or the default value if null is passed or there are no enum values with the given id.
-
Constructor Details
-
EnumUtils
public EnumUtils()
-
-
Method Details
-
fromId
Returns an enum value for the given id.- Parameters:
e
- enum classid
- id- Returns:
- enum value or null if the passed id is null
- Throws:
IllegalArgumentException
- if there are no enum values with the given id
-
fromId
Returns an enum value for the given id.- Parameters:
e
- enum classid
- iddefaultValue
- the value to return if null is passed as id- Returns:
- enum value
- Throws:
IllegalArgumentException
- if there are no enum values with the given id
-
fromIdSafe
Returns an enum value for the given id, or the default value if null is passed or there are no enum values with the given id.- Parameters:
e
- enum classid
- iddefaultValue
- the value to return if null is passed as id or if there are no enum values with the given id- Returns:
- enum value
-