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

org.simpleflatmapper.map.fieldmapper.FieldMapperGetterWithConverter Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
package org.simpleflatmapper.map.fieldmapper;

import org.simpleflatmapper.converter.Context;
import org.simpleflatmapper.converter.ContextualConverter;
import org.simpleflatmapper.map.getter.ContextualGetter;

import static org.simpleflatmapper.util.Asserts.requireNonNull;

public class FieldMapperGetterWithConverter implements ContextualGetter {

    private final ContextualConverter converter;
    private final ContextualGetter getter;

    public FieldMapperGetterWithConverter(ContextualConverter converter, ContextualGetter getter) {
        this.converter = requireNonNull("converter", converter);;
        this.getter = requireNonNull("getter", getter);;
    }

    @Override
    public P get(T target, Context context) throws Exception {
        I in = getter.get(target, context);
        return converter.convert(in, context);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy