com.avioconsulting.mule.maven.formatter.FormatOptionsEnum Maven / Gradle / Ivy
The newest version!
package com.avioconsulting.mule.maven.formatter;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
public enum FormatOptionsEnum {
CONSOLE("console"),
JSON("json");
private static final Map mapValues = Collections.unmodifiableMap(initializeMapping());
private String value;
private FormatOptionsEnum(String code){
this.value= code;
}
private static Map initializeMapping() {
Map map = new HashMap<>();
for (FormatOptionsEnum fo : FormatOptionsEnum.values()) {
map.put(fo.value.toLowerCase(), fo);
}
return map;
}
public static Optional fromString(String formatString){
return Optional.ofNullable(mapValues.get(formatString.toLowerCase()));
}
public Object getValue() {
return this.value;
}
}