Top Description Methods
org.keycloak.util

public Interface EnumWithStableIndex

Known Direct Implementers
org.keycloak.representations.idm.authorization.PolicyEnforcementMode, org.keycloak.representations.idm.authorization.DecisionStrategy, org.keycloak.representations.idm.authorization.Logic
Imports
java.util.Map, java.util.function.Function, java.util.stream.Collectors, .Stream

Classes implementing this interface guarantee that for each instance of this class, there exists an mutually unique integer which is stable in time, and identifies always the same instance of this class. The index might be used for persistence, hence the index of a particular item cannot be changed. This is mostly usable for @{code enum}s.

Method Summary

Modifier and TypeMethod and Description
public static <E extends EnumWithStableIndex> Map<Integer, E>
getReverseIndex(E[] values)

public int

Returns:

Unique numeric index which is stable in time and identifies an instance. Reusing the same index for two distinct entries of the same class is forbidden even if they cannot exist at the same time (e.g. one is deleted before other is introduced).
getStableIndex
()

Method Detail

getReverseIndexback to summary
public static <E extends EnumWithStableIndex> Map<Integer, E> getReverseIndex(E[] values)
getStableIndexback to summary
public int getStableIndex()
Returns:int

Unique numeric index which is stable in time and identifies an instance. Reusing the same index for two distinct entries of the same class is forbidden even if they cannot exist at the same time (e.g. one is deleted before other is introduced).