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

org.jboss.resteasy.reactive.common.headers.ObjectToStringDelegate Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package org.jboss.resteasy.reactive.common.headers;

import java.util.Objects;

import jakarta.ws.rs.ext.RuntimeDelegate;

public class ObjectToStringDelegate implements RuntimeDelegate.HeaderDelegate {
    public static final ObjectToStringDelegate INSTANCE = new ObjectToStringDelegate();

    @Override
    public Object fromString(String value) {
        if (value == null)
            throw new IllegalArgumentException("Param was null");
        throw new IllegalArgumentException("Does not support fromString");
    }

    @Override
    public String toString(Object value) {
        if (value == null)
            throw new IllegalArgumentException("Param was null");
        return Objects.toString(value);
    }
}