Package org.iam.policy.grammer
Interface StringComparableEnum
- All Known Implementing Classes:
Condition.VarOperator,Statement.VarEffect
public interface StringComparableEnum
Interface for enums that can be compared and retrieved by string value.
Provides utility methods for case-insensitive string matching and conversion.
- Since:
- 2025-02-28
- Author:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T> & StringComparableEnum>
TfromString(String value, Class<T> enumClass) Returns the enum constant matching the given string value (case-insensitive).getValue()Returns the string value associated with the enum constant.static booleanChecks if the given string matches any value in the enum (case-insensitive).
-
Method Details
-
getValue
String getValue()Returns the string value associated with the enum constant.- Returns:
- the string value
-
isValid
Checks if the given string matches any value in the enum (case-insensitive).- Parameters:
value- the string to checkenumClass- the enum class- Returns:
- true if a match is found, false otherwise
-
fromString
Returns the enum constant matching the given string value (case-insensitive).- Type Parameters:
T- the enum type- Parameters:
value- the string value to matchenumClass- the enum class- Returns:
- the matching enum constant
- Throws:
IllegalArgumentException- if no match is found
-