EnumConverter

Converts objects to Enums.

Description

The EnumConverter allows you to convert objects to Enums

Static methods

ToEnum

Converts an object to an Enum.

public static <T extends Enum> T toEnum(Class type, Object value)

  • type: Class - type
  • value: Object - object to be converted
  • returns: <T extends Enum> T - returned Enum

ToEnumWithDefault

Converts an object to an Enum or returns a given default value when the conversion is not possible. .

public static <T extends Enum> T toEnumWithDefault(Class type, Object value, T defaultValue)

  • type: Class - type
  • value: Object - object to be converted
  • defaultValue: T - default value
  • returns: <T extends Enum> T - returned Enum or given default whe the conversion is not possible.

ToNullableEnum

Converts an object to an Enum or returns null when the conversion is not possible..

public static <T extends Enum> T toNullableEnum(Class type, Object value)

  • type: <T extends Enum> T - value to be converted
  • value: Object - value to be converted
  • returns: <T extends Enum> T - returned Enum or null when the conversion is not possible