org.javers.java8support.DurationTypeAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javers-core Show documentation
Show all versions of javers-core Show documentation
JaVers - object auditing and diff framework for Java
package org.javers.java8support;
import org.javers.core.json.BasicStringTypeAdapter;
import java.time.Duration;
/**
* @author bartosz.walacik
*/
class DurationTypeAdapter extends BasicStringTypeAdapter {
@Override
public String serialize(Duration sourceValue) {
return sourceValue.toString();
}
@Override
public Duration deserialize(String serializedValue) {
return Duration.parse(serializedValue);
}
@Override
public Class getValueType() {
return Duration.class;
}
}