Class Enums

java.lang.Object
io.dropwizard.util.Enums

public class Enums extends Object
Helper methods for enum types.
  • Constructor Details

    • Enums

      public Enums()
  • Method Details

    • fromStringFuzzy

      public static @Nullable Enum<?> fromStringFuzzy(String value, Enum<?>[] constants)
      Convert a string to an enum with more permissive rules than Enum valueOf().
      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 the Enum to which you wish to convert.
      Returns:
      The enum or null, if no enum constant matched the input value.