
com.spikeify.converters.EnumConverter 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.TypeUtils;
import java.lang.reflect.Type;
@SuppressWarnings("unchecked")
public class EnumConverter> implements Converter {
private final Class enumClass;
public EnumConverter(Type type) {
enumClass = (Class) TypeUtils.erase(type);
}
public E fromProperty(String property) {
return property == null ? null : Enum.valueOf(enumClass, property);
}
public String fromField(E fieldValue) {
return fieldValue.name();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy