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

com.wizzdi.dynamic.properties.converter.JsonConverter Maven / Gradle / Ivy

package com.wizzdi.dynamic.properties.converter;

import jakarta.persistence.Converter;
import java.util.Map;

@Converter(autoApply = false)
public class JsonConverter implements jakarta.persistence.AttributeConverter, Object> {

    static JsonConverterImplementation implementation = null;

    @Override
    public Object convertToDatabaseColumn(Map objectValue) {
        if (implementation == null) {
            throw new IllegalArgumentException("Unable to serialize to json field , no concrete implementation");
        }
        return implementation.convertToDatabaseColumn(objectValue);

    }

    @Override
    public Map convertToEntityAttribute(Object dataValue) {
        if (implementation == null) {
            throw new IllegalArgumentException("Unable to deserialize from json field , no concrete implementation");
        }
        return implementation.convertToEntityAttribute(dataValue);

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy