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

org.sfm.querydsl.getter.EnumTupleNamedIndexedGetter Maven / Gradle / Ivy

There is a newer version: 8.2.3
Show newest version
package org.sfm.querydsl.getter;

import com.mysema.query.Tuple;
import org.sfm.querydsl.TupleElementKey;
import org.sfm.reflect.Getter;

public final class EnumTupleNamedIndexedGetter> implements Getter {

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy