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

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

There is a newer version: 7.18.1
Show newest version
package cucumber.runtime.xstream;

import cucumber.deps.com.thoughtworks.xstream.converters.SingleValueConverterWrapper;

import java.util.Locale;

/**
 * Creates an instance of needed {@link cucumber.runtime.xstream.ConverterWithEnumFormat} dynamically based on required type
 */
class DynamicEnumConverter extends DynamicClassBasedSingleValueConverter {

    private final Locale locale;

    DynamicEnumConverter(Locale locale) {
        this.locale = locale;
    }

    @Override
    public SingleValueConverterWrapper converterForClass(Class type) {
        return new SingleValueConverterWrapperExt(new ConverterWithEnumFormat(locale, type));
    }

    @Override
    public boolean canConvert(Class type) {
        return type.isEnum();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy