All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.zalando.sprocwrapper.globalvaluetransformer.ValueTransformerUtils Maven / Gradle / Ivy

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