Package io.dropwizard.util
Class Enums
java.lang.Object
io.dropwizard.util.Enums
Helper methods for enum types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Enum<?>fromStringFuzzy(String value, Enum<?>[] constants) Convert a string to an enum with more permissive rules thanEnumvalueOf().
-
Constructor Details
-
Enums
public Enums()
-
-
Method Details
-
fromStringFuzzy
Convert a string to an enum with more permissive rules thanEnumvalueOf().
This method is more permissive in the following ways:- Whitespace is permitted but stripped from the input.
- Dashes and periods in the value are converted to underscores.
- Matching against the enum values is case insensitive.
- Parameters:
value- The string to convert.constants- The list of constants for theEnumto which you wish to convert.- Returns:
- The enum or null, if no enum constant matched the input value.
-