package com.onaro.sanscreen.client.view.tabular.columns; import org.apache.commons.lang3.StringUtils; import com.onaro.sanscreen.client.view.tabular.value.IntegerTextValue; /** * Presenter implementation that converts String values to {@link IntegerTextValue}s, to provide * numeric sorting behavior when the string values are numeric. This class is a Singleton, which * can be accessed via the {@link #INSTANCE} static member. * * @see IntegerTextValue */ public class IntegerTextValuePresenter extends AbstractColumnValuePresenter { /** * Presenter implementation that converts String values to {@link IntegerTextValue}s, to provide * numeric sorting behavior when the string values are numeric. * @see IntegerTextValue */ public static final IntegerTextValuePresenter INSTANCE = new IntegerTextValuePresenter(); private IntegerTextValuePresenter() { super(IntegerTextValue.class); } @Override public IntegerTextValue getPresentation(String value, String identifier) { return StringUtils.isBlank(value)? null : IntegerTextValue.parse(value); } }