cucumber.runtime.converters.ConverterWithNumberFormat Maven / Gradle / Ivy
package cucumber.runtime.converters;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public abstract class ConverterWithNumberFormat extends ConverterWithFormat {
private final List formats = new ArrayList();
public ConverterWithNumberFormat(Locale locale, Class[] convertibleTypes) {
super(convertibleTypes);
formats.add(NumberFormat.getNumberInstance(locale));
}
@Override
public T fromString(String string) {
T number = super.fromString(string);
return number == null ? null : downcast(number);
}
@Override
public List getFormats() {
return formats;
}
protected abstract T downcast(Number argument);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy