@Override
		public T convert(String source) {
			if (StringUtils.isEmpty(source)) {
				return null;
			}
			source = source.trim();
			for (T candidate : (Set<T>) EnumSet.allOf(this.enumType)) {
				RelaxedNames names = new RelaxedNames(candidate.name()
						.replace("_", "-").toLowerCase());
				for (String name : names) {
					if (name.equals(source)) {
						return candidate;
					}
				}
				if (candidate.name().equalsIgnoreCase(source)) {
					return candidate;
				}
			}
			throw new ConversionFailedException(TypeDescriptor.valueOf(String.class),
					TypeDescriptor.valueOf(enumType), source, null);
		}
Copied from {@code org.springframework.boot.bind.RelaxedConversionService}.

@author Gunnar Hillert
spring-xd-module/src/main/java/org/springframework/xd/module/options/support/StringToEnumIgnoringCaseConverterFactory.java