ConverterType() { this.name = this.name().toLowerCase(Locale.ROOT); }
/** * Get the type of converter as defined by the {@link #TYPE_CONFIG} configuration. * @return the converter type; never null */ public ConverterType type() { return ConverterType.withName(getString(TYPE_CONFIG)); } }
/** * Create a new {@link ConfigDef} instance containing the configurations defined by ConverterConfig. This can be called by subclasses. * * @return the ConfigDef; never null */ public static ConfigDef newConfigDef() { return new ConfigDef().define(TYPE_CONFIG, Type.STRING, ConfigDef.NO_DEFAULT_VALUE, in(ConverterType.KEY.getName(), ConverterType.VALUE.getName(), ConverterType.HEADER.getName()), Importance.LOW, TYPE_DOC); }
public Converter getValueConverter() { Map<String, Object> conf = simpleConfig.originals(); conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.VALUE.getName()); SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); return config.getConfiguredInstance( SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class); }
public HeaderConverter getHeaderConverter() { Map<String, Object> conf = simpleConfig.originals(); conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.HEADER.getName()); SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); return config.getConfiguredInstance( SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class); } }
public Converter getKeyConverter() { Map<String, Object> conf = simpleConfig.originals(); conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.KEY.getName()); SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); return config.getConfiguredInstance( SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class); }
converterConfig.put(ConverterConfig.TYPE_CONFIG, ConverterType.HEADER.getName()); log.debug("Configuring the header converter with configuration:{}{}", System.lineSeparator(), converterConfig); plugin.configure(converterConfig);