Search in sources :

Example 1 with CellValueProducerFactory

use of org.knime.core.data.convert.map.CellValueProducerFactory in project knime-core by knime.

the class SerializeUtil method loadProductionPath.

/**
 * Load a {@link ProductionPath} from given config.
 *
 * @param config Config to load from
 * @param registry Registry to load producer with
 * @param key setting key
 * @return an optional {@link ProductionPath}, present if the converter factory identifier was found in the
 *         {@link JavaToDataCellConverterRegistry} and producer factory identifier was found in the registry.
 * @throws InvalidSettingsException
 * @since 3.6
 */
public static <ExternalType, SourceType extends Source<ExternalType>> Optional<ProductionPath> loadProductionPath(final ConfigBaseRO config, final ProducerRegistry<ExternalType, SourceType> registry, final String key) throws InvalidSettingsException {
    final Optional<JavaToDataCellConverterFactory<?>> converter = loadJavaToDataCellConverterFactory(config, key + "_converter");
    if (!converter.isPresent()) {
        return Optional.empty();
    }
    final Optional<CellValueProducerFactory<SourceType, ExternalType, ?, ?>> producer = loadConverterFactory(config, registry, key + "_producer");
    if (!producer.isPresent()) {
        return Optional.empty();
    }
    return Optional.of(new ProductionPath(producer.get(), converter.get()));
}
Also used : CellValueProducerFactory(org.knime.core.data.convert.map.CellValueProducerFactory) ProductionPath(org.knime.core.data.convert.map.ProductionPath) JavaToDataCellConverterFactory(org.knime.core.data.convert.datacell.JavaToDataCellConverterFactory)

Aggregations

JavaToDataCellConverterFactory (org.knime.core.data.convert.datacell.JavaToDataCellConverterFactory)1 CellValueProducerFactory (org.knime.core.data.convert.map.CellValueProducerFactory)1 ProductionPath (org.knime.core.data.convert.map.ProductionPath)1