use of com.torodb.kvdocument.values.KvInstant in project torodb by torodb.
the class InstantValueConverter method to.
@Override
public Timestamp to(KvInstant userObject) {
Instant instant = userObject.getValue();
try {
Timestamp ts = new Timestamp(instant.getEpochSecond() * 1000);
ts.setNanos(instant.getNano());
return ts;
} catch (ArithmeticException ex) {
throw new IllegalArgumentException(ex);
}
}
use of com.torodb.kvdocument.values.KvInstant in project torodb by torodb.
the class InstantValueConverter method to.
@Override
public Timestamp to(KvInstant userObject) {
Instant instant = userObject.getValue();
try {
Timestamp ts = new Timestamp(instant.getEpochSecond() * 1000);
ts.setNanos(instant.getNano());
return ts;
} catch (ArithmeticException ex) {
throw new IllegalArgumentException(ex);
}
}
use of com.torodb.kvdocument.values.KvInstant in project torodb by torodb.
the class TestConvertJson method parseDate.
@Test
public void parseDate() {
KvDocument doc = parser.createFromResource("DateField.json");
assertTrue(doc.containsKey("creation"));
KvValue<?> creation = doc.get("creation");
assertTrue(creation instanceof KvInstant);
}
Aggregations