io.quarkus.funqy.runtime.query.QueryMapReader Maven / Gradle / Ivy
package io.quarkus.funqy.runtime.query;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import io.quarkus.arc.impl.Reflections;
/**
* Key can be any primitive, primitive object (i.e. Integer), or String
* Value can be any primitive, primitive object, string, or bean style class
*
*/
class QueryMapReader extends BaseObjectReader implements BaseObjectReader.ValueSetter {
private Function keyExtractor;
private Function valueExtractor;
private QueryPropertySetter setter;
public QueryMapReader(Type genericType, QueryObjectMapper mapper) {
if (genericType == null) {
keyExtractor = mapper.extractor(String.class);
valueExtractor = mapper.extractor(String.class);
return;
}
if (genericType instanceof ParameterizedType) {
Type keyType = ((ParameterizedType) genericType).getActualTypeArguments()[0];
keyExtractor = mapper.extractor(keyType);
if (keyType == null)
throw new RuntimeException("Illegal key type for map");
Type valueType = ((ParameterizedType) genericType).getActualTypeArguments()[1];
if (valueType != null) {
Class
© 2015 - 2025 Weber Informatics LLC | Privacy Policy