com.peterphi.std.guice.restclient.converter.DurationStringConverter Maven / Gradle / Ivy
package com.peterphi.std.guice.restclient.converter;
import org.joda.time.Duration;
import javax.ws.rs.ext.ParamConverter;
import javax.ws.rs.ext.Provider;
@Provider
class DurationStringConverter implements ParamConverter
{
@Override
public Duration fromString(final String str)
{
if (str == null)
return null;
else
return new Duration(str);
}
@Override
public String toString(final Duration value)
{
if (value == null)
return null;
else
return value.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy