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

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

package org.sfm.jooq.getter;

import org.jooq.Record;
import org.sfm.jooq.JooqFieldKey;
import org.sfm.reflect.Getter;

public final class EnumRecordNamedGetter> implements Getter {

	private final int index;
	private final Class enumType;
	
	public EnumRecordNamedGetter(final JooqFieldKey key, Class enumType) {
		this.index = key.getIndex();
		this.enumType = enumType;
	}

	@Override
	public E get(final R target) throws Exception {
		final Object o = target.getValue(index);
		return (E) Enum.valueOf(enumType, String.valueOf(o));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy