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

org.shoulder.web.template.dictionary.convert.BaseDictionaryItem2StrJpaConverter Maven / Gradle / Ivy

Go to download

shoulder WEB 模块,基于Spring Boot Web提供了 Controller AOP 日志、AOP异常处理,统一返回值,健康检查,租户、用户解析,Web 安全防护,通用CrudController,动态字典,标签管理,HTTP client AOP日志、AOP异常处理等能力,助力Web飞速开发。

The newest version!
package org.shoulder.web.template.dictionary.convert;

import jakarta.persistence.AttributeConverter;
import org.shoulder.core.dictionary.convert.DictionaryItemConversions;
import org.shoulder.core.dictionary.model.DictionaryItem;

/**
 * JPA ex-字典类 field 转换
 * 注意该类不要直接时候
 *
 * @author lym
 */
public abstract class BaseDictionaryItem2StrJpaConverter implements AttributeConverter {

    protected final Class actuallyType;

    public BaseDictionaryItem2StrJpaConverter(Class actuallyType) {
        this.actuallyType = actuallyType;
    }

    @Override
    public String convertToDatabaseColumn(DictionaryItem dictionaryItem) {
        return DictionaryItemConversions.toStr(dictionaryItem);
    }

    @Override
    public DictionaryItem convertToEntityAttribute(String s) {
        return DictionaryItemConversions.toItem(s, actuallyType);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy