MotechEnumUtils

public final class MotechEnumUtils

Misc enum-related helper functions

Methods

toEnumSet

public static <T extends Enum> Set<T> toEnumSet(Class<T> enumClass, Set<String> strings)

Returns a set of enums given a set of strings and an enum class

Parameters:
  • enumClass – the enum class
  • strings – a set of strings
Returns:

the enum set constructed from the given string set

toEnumSet

public static <T extends Enum> Set<T> toEnumSet(Class<T> enumClass, String csv)

Returns a set of enums given a comma separated string and an enum class

Parameters:
  • enumClass – the enum class
  • csv – a comma separated string representing a set of enum values
Returns:

the enum set constructed from the given string

toString

public static String toString(Set<? extends Enum> items)

Returns a csv string given a set of enums

Parameters:
  • items – a set of enums
Returns:

the csv string constructed from the given enum set

toStringSet

public static Set<String> toStringSet(Set<? extends Enum> items)

Returns a set of strings given a set of enums

Parameters:
  • items – a set of enums
Returns:

the string set constructed from the given enum set