
com.spikeify.converters.BooleanConverter 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;
public class BooleanConverter implements Converter, ConverterFactory {
@Override
public Converter init(Field field) {
return this;
}
public boolean canConvert(Class type) {
return Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type);
}
public Boolean fromProperty(Long property) {
return property != null && property != 0;
}
public Long fromField(Boolean fieldValue) {
return (long) (fieldValue ? 1 : 0);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy