org.javers.java8support.InstantTypeAdapter 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.Instant;
/**
* @author bartosz.walacik
*/
class InstantTypeAdapter extends BasicStringTypeAdapter {
@Override
public String serialize(Instant sourceValue) {
return sourceValue.toString();
}
@Override
public Instant deserialize(String serializedValue) {
return Instant.parse(serializedValue);
}
@Override
public Class getValueType() {
return Instant.class;
}
}