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

com.kenshoo.pl.entity.InverseValueConverter Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.pl.entity;

/**
 * Inverse any ValueConverter.
 * If you have String to Enum converter, use this implementation to have opposite one - Enum to String.
 */
public class InverseValueConverter implements ValueConverter{

    private final ValueConverter converter;
    private final Class targetClass;

    public InverseValueConverter(ValueConverter converter, Class targetClass) {
        this.converter = converter;
        this.targetClass = targetClass;
    }

    @Override
    public T2 convertTo(T value) {
        return converter.convertFrom(value);
    }

    @Override
    public T convertFrom(T2 value) {
        return converter.convertTo(value);
    }

    @Override
    public Class getValueClass() {
        return targetClass;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy