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

io.github.factoryfx.microservice.common.ResponseWorkaround Maven / Gradle / Ivy

The newest version!
package io.github.factoryfx.microservice.common;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

//just generic return doesn't work with the proxy client
public class ResponseWorkaround {
    @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
    public T value;

    @SuppressWarnings("unchecked")
    @JsonCreator
    public ResponseWorkaround(@JsonProperty("value") T value) {
        if (value instanceof ResponseWorkaround) {//jackson bug
            this.value = (T) ((ResponseWorkaround)value).value;
        } else {
            this.value = value;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy