
com.spikeify.converters.MapConverterFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Simple ORM for Aerospike
package com.spikeify.converters;
import com.spikeify.Converter;
import com.spikeify.ConverterFactory;
import com.spikeify.TypeUtils;
import com.spikeify.annotations.AsJson;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.Map;
public class MapConverterFactory implements ConverterFactory {
@SuppressWarnings("unchecked")
@Override
public Converter init(Field field) {
Type valueType = TypeUtils.getMapValueType(field);
if (valueType != null && valueType instanceof Class) {
Class classType = (Class) valueType;
if (classType.isAnnotationPresent(AsJson.class)) {
Class fieldType = field.getType();
return new MapJsonConverter(fieldType, classType);
}
}
return new MapConverter();
}
public boolean canConvert(Class type) {
return Map.class.isAssignableFrom(type);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy