class EnumConverter implements ConditionalConverter<Object, Enum<?>> {
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Enum<?> convert(MappingContext<Object, Enum<?>> context) {<FILL_FUNCTION_BODY>}

  public MatchResult match(Class<?> sourceType, Class<?> destinationType) {
    return isEnum(destinationType) && (isEnum(sourceType) || sourceType == String.class) ? MatchResult.FULL
        : MatchResult.NONE;
  }

  private boolean isEnum( Class<?> type ) {
      return type.isAnonymousClass() ? isEnum( type.getSuperclass() ) : type.isEnum();
  }
}

    Object source = context.getSource();
    if (source == null)
      return null;

    String name = source.getClass() == String.class ? (String) source : ((Enum<?>) source).name();

    if (name != null)
      try {
        return Enum.valueOf((Class) context.getDestinationType(), name);
      } catch (IllegalArgumentException ignore) {
      }

    return null;
  
<no_super_class>