com.kenshoo.pl.entity.InverseValueConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of persistence-layer Show documentation
Show all versions of persistence-layer Show documentation
A Java persistence layer based on JOOQ for high performance and business flow support.
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