
de.zalando.sprocwrapper.globalvaluetransformer.ValueTransformerUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zalando-sprocwrapper Show documentation
Show all versions of zalando-sprocwrapper Show documentation
Library to make PostgreSQL stored procedures available through simple Java "*SProcService" interfaces
including automatic object serialization and deserialization (using typemapper and
convention-over-configuration). Supports sharding, advisory locking, statement timeouts and PostgreSQL types
such as enums and hstore.
package de.zalando.sprocwrapper.globalvaluetransformer;
import java.lang.reflect.Method;
import de.zalando.typemapper.core.ValueTransformer;
public final class ValueTransformerUtils {
private ValueTransformerUtils() { }
public static Class> getMarshalToDbClass(final Class> valueTransformer) {
final Method method = ReflectionUtils.findMethod(valueTransformer, "marshalToDb");
if (method != null) {
return method.getReturnType();
}
return null;
}
public static Class> getUnmarshalFromDbClass(final Class> valueTransformerClass) {
final Method method = ReflectionUtils.findMethod(valueTransformerClass, "unmarshalFromDb");
if (method != null) {
return method.getReturnType();
}
return null;
}
public static Class> getMarshalToDbClass(final ValueTransformer, ?> valueTransformerForClass) {
return valueTransformerForClass != null ? getMarshalToDbClass(valueTransformerForClass.getClass()) : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy