
com.spikeify.converters.EnumConverterFactory 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 java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class EnumConverterFactory implements ConverterFactory {
private static final Map cachedConverters = new ConcurrentHashMap<>();
@Override
public Converter init(Field field) {
Type fieldType = field.getType();
EnumConverter converter = cachedConverters.get(fieldType);
if (converter == null) {
converter = new EnumConverter(fieldType);
cachedConverters.put(fieldType, converter);
}
return converter;
}
public boolean canConvert(Class type) {
return Enum.class.isAssignableFrom(type);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy