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

org.sfm.jooq.getter.RecordGetterWithConverter Maven / Gradle / Ivy

package org.sfm.jooq.getter;

import org.jooq.Record;
import org.sfm.reflect.Getter;
import org.sfm.utils.conv.Converter;

public class RecordGetterWithConverter implements Getter {

	private final int index;
	private final Converter converter;
	
	public RecordGetterWithConverter(int index, Converter converter) {
		this.index = index;
		this.converter = converter;
	}

	@SuppressWarnings("unchecked")
	@Override
	public P get(R target) throws Exception {
		F value = (F) target.getValue(index);
		if (value != null) {
			return (P) converter.convert(value);
		} else {
			return null;
		}
	}
	
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy