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

io.edurt.datacap.service.converter.UserEditorConverter Maven / Gradle / Ivy

There is a newer version: 2024.4.0
Show newest version
package io.edurt.datacap.service.converter;

import io.edurt.datacap.common.utils.JsonUtils;
import io.edurt.datacap.service.entity.itransient.user.UserEditorEntity;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.AttributeConverter;

public class UserEditorConverter
        implements AttributeConverter
{
    @Override
    public String convertToDatabaseColumn(UserEditorEntity userEditorEntity)
    {
        return JsonUtils.toJSON(userEditorEntity);
    }

    @Override
    public UserEditorEntity convertToEntityAttribute(String s)
    {
        if (StringUtils.isEmpty(s)) {
            return null;
        }
        else {
            return JsonUtils.toObject(s, UserEditorEntity.class);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy