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

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

package org.sfm.jooq.getter;

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

public final class EnumRecordOrdinalGetter> implements  Getter {

	private final int index;
	private final E[] values;
	

	public EnumRecordOrdinalGetter(JooqFieldKey key, final Class enumType) {
		this.index = key.getIndex();
		this.values = EnumHelper.getValues(enumType);
	}

	@Override
	public E get(final R target) throws Exception {
		return values[((Number)target.getValue(index)).intValue()];
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy