class AbstractJsonConverter<T> implements AttributeConverter<T, String> {

    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

    private final TypeReference<T> typeReference;

    AbstractJsonConverter(final TypeReference<T> typeReference) {
        this.typeReference = typeReference;
    }

    @Override
    public String convertToDatastore(final T attributeValue) {
        if (attributeValue == null) {
            return null;
        }

        try {
            return OBJECT_MAPPER.writeValueAsString(attributeValue);
        } catch (JacksonException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public T convertToAttribute(final String datastoreValue) {<FILL_FUNCTION_BODY>}

}

        if (datastoreValue == null) {
            return null;
        }

        try {
            return OBJECT_MAPPER.readValue(datastoreValue, typeReference);
        } catch (JacksonException e) {
            throw new RuntimeException(e);
        }
    
<no_super_class>