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

io.github.kiryu1223.drink.ext.IConverter Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package io.github.kiryu1223.drink.ext;

import io.github.kiryu1223.drink.core.metaData.PropertyMetaData;
import io.github.kiryu1223.drink.core.visitor.ExpressionUtil;

import java.lang.reflect.Type;

public interface IConverter
{
    D toDb(J value, PropertyMetaData propertyMetaData);

    J toJava(D value, PropertyMetaData propertyMetaData);

    default Class getDbType()
    {
        Type[] interfaces = this.getClass().getGenericInterfaces();
        Type type = interfaces[0];
        return ExpressionUtil.getType(type, 1);
    }

    default Class getJavaType()
    {
        Type[] interfaces = this.getClass().getGenericInterfaces();
        Type type = interfaces[0];
        return ExpressionUtil.getType(type, 0);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy