ComboBox with Integer values (true way @Encode)

Hi!

I used a ComboBox with integer values (on client side - as double) and string labels (PolymerTemplate).
In the template model, a getter was declared for combobox value (return Integer) with @Encoder for transform Integer<->Double.
For initial state: value=null - ok
For item selection: value=Double->Integer - ok
For clearing selection: value=String=‘’ (not null!) - error!
How to correctly implement this dual type case? Is the usage of string values the only way?

Bean for ComboBox items:

public class UIComboItem {
    private Integer value;
    private String label;

    public UIComboItem(Integer value, String label) {
        this.value = value;
        this.label = label;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }
}

Template model:

public interface UIModel extends TemplateModel {

		void setFirms(List<UIComboItem> items);
		
        @Encode(IntegerToDoubleEncoder.class)
        Integer getIdFirm();
}

Value encoder:

public static class IntegerToDoubleEncoder implements ModelEncoder<Integer, Double> {

        @Override
        public Double encode(Integer modelValue) {
            return modelValue == null ? null : new Double(modelValue);
        }

        @Override
        public Integer decode(Double presentationValue) {
            return presentationValue == null ? null : presentationValue.intValue();
        }
}

Polymer template html:

<vaadin-combo-box items="[[firms]
] value="{{idFirm}}"></vaadin-combo-box>

Simplest way: use integer values into bean and string values on client side (and Integer<->String @Encoder).

public interface UIModel extends TemplateModel {
	...
	@Encode(IntegerToStringEncoder.class)
	Integer getIdFirm();
	...
}

public class UIComboItem {
	...
	@Encode(IntegerToStringEncoder.class)
    public Integer getValue() {
        return value;
    }
	...
}

public static class IntegerToStringEncoder implements ModelEncoder<Integer, String> {

    @Override
	public String encode(Integer modelValue) {
		return modelValue == null ? null : modelValue.toString();
	}

	@Override
	public Integer decode(String presentationValue) {
		if (presentationValue == null) return null;
		if ((presentationValue = presentationValue.trim()).isEmpty()) return null;
		return new Integer(presentationValue);
	}
}