All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cucumber.runtime.xstream.ConverterWithNumberFormat Maven / Gradle / Ivy

package cucumber.runtime.xstream;

import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

abstract class ConverterWithNumberFormat extends ConverterWithFormat {
    private final List formats = new ArrayList();

    ConverterWithNumberFormat(Locale locale, Class[] convertibleTypes) {
        super(convertibleTypes);
        formats.add(NumberFormat.getNumberInstance(locale));
    }

    @Override
    public T transform(String string) {
        T number = super.transform(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