Interface KeyedEnumTranslator<W>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <W> KeyedEnumTranslator<W> Translator that maps wrapper to NMS by uppercasing a key extracted from the wrapper, and inverts by walking all wrapper constants and finding the one whose key matches (case-insensitively) the NMS enum's name.static <W extends Enum<W>>
KeyedEnumTranslator<W> Translator that uses the wrapper enum's ownname()as the key.fromNms(N nmsEnum) <N extends Enum<N>>
N
-
Method Details
-
toNms
-
fromNms
-
byKey
@AsOf("2.1.0") @Contract(value="_, _ -> new", pure=true) static <W> KeyedEnumTranslator<W> byKey(Function<W, String> keyExtractor, W[] wrapperValues) Translator that maps wrapper to NMS by uppercasing a key extracted from the wrapper, and inverts by walking all wrapper constants and finding the one whose key matches (case-insensitively) the NMS enum's name.- Parameters:
keyExtractor- extracts the key from a wrapper instance (typically lowercase)wrapperValues- all values of the wrapper enum (typicallyMyEnum.values())- Since:
- 2.0.0
-
byName
@AsOf("2.1.0") @Contract(value="_ -> new", pure=true) static <W extends Enum<W>> KeyedEnumTranslator<W> byName(Class<W> wrapperClass) Translator that uses the wrapper enum's ownname()as the key. Inverse lookup usesEnum.valueOfon the wrapper class.- Parameters:
wrapperClass- the wrapper enum class, used for inverse lookup- Since:
- 2.0.0
-