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

org.jboss.resteasy.reactive.common.headers.DateDelegate 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.Date;

import jakarta.ws.rs.ext.RuntimeDelegate;

import org.jboss.resteasy.reactive.common.util.DateUtil;

/**
 * @author Bill Burke
 */
public class DateDelegate implements RuntimeDelegate.HeaderDelegate {
    public static final DateDelegate INSTANCE = new DateDelegate();

    @Override
    public Date fromString(String value) {
        if (value == null)
            throw new IllegalArgumentException("Param was null");
        return DateUtil.parseDate(value);
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy