class MyStringConverter extends StringConverter<String> {

        @Override
        public String toString(String value) {
            return (value != null) ? value : "";
        }

        @Override
        public String fromString(String value) {<FILL_FUNCTION_BODY>}
    }

            // Avoid false positives (ie showing an error that we match ourselves)
            if (value.equalsIgnoreCase(labelString)) {
                return value;
            } else if (value.isEmpty()) {
                LOGGER.info("An enum field cannot be empty. Please remove the field instead.");
                return labelString;
            }

            // Make sure this is not a duplicate entry
            final AtomicBoolean duplicate = new AtomicBoolean(false);
            strings.stream()
                .filter(elem -> elem.equalsIgnoreCase(value))
                .forEach(elem -> duplicate.set(true));
            if (duplicate.get()){
                LOGGER.info("Enum cannot contain the same constant twice");
                return labelString;

            // Make sure this entry contains only legal characters
            } else if ( !value.matches("([\\w\\-\\_\\ ]+)")) {
                LOGGER.info("Enum should only contain letters, number, underscore and/or dashes");
                return labelString;

            // Warn if it contains a space
            } else if (value.contains(" ")) {
                LOGGER.warn("Enum spaces will be converted to underscores in Java");
                return value;
            } else {
                return value;
            }
        
<methods>public void <init>() ,public void <init>(StringConverter<java.lang.String>) ,public void cancelEdit() ,public final ObjectProperty<StringConverter<java.lang.String>> converterProperty() ,public static Callback<ListView<java.lang.String>,ListCell<java.lang.String>> forListView() ,public static Callback<ListView<T>,ListCell<T>> forListView(StringConverter<T>) ,public final StringConverter<java.lang.String> getConverter() ,public final void setConverter(StringConverter<java.lang.String>) ,public void startEdit() ,public void updateItem(java.lang.String, boolean) <variables>private ObjectProperty<StringConverter<java.lang.String>> converter,private javafx.scene.control.TextField textField