Example usage for java.time Instant toString

List of usage examples for java.time Instant toString

Introduction

In this page you can find the example usage for java.time Instant toString.

Prototype

@Override
public String toString() 

Source Link

Document

A string representation of this instant using ISO-8601 representation.

Usage

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
    System.out.println(instant.toString());

}

From source file:com.databasepreservation.visualization.utils.SolrUtils.java

private static String processFromDate(Date fromValue) {
    final String ret;

    if (fromValue != null) {
        Instant instant = Instant.ofEpochMilli(fromValue.getTime());
        return instant.toString();
    } else {/*  w w  w. j  a v  a  2  s. c  o m*/
        ret = "*";
    }

    return ret;
}

From source file:com.toedter.chatty.server.boot.config.JsonInstantSerializer.java

@Override
public void serialize(Instant instant, JsonGenerator gen, SerializerProvider provider)
        throws IOException, JsonProcessingException {
    String timeStamp = instant.toString();
    gen.writeString(timeStamp);/*  w w  w  .ja  v a 2 s .c om*/
}

From source file:info.losd.galen.json.InstantToStringSerializer.java

@Override
public void serialize(Instant value, JsonGenerator jgen, SerializerProvider provider)
        throws IOException, JsonProcessingException {
    jgen.writeObject(value.toString());
}

From source file:hub.backends.jobs.JobsQuery.java

private Thing<Jobs> wrapJobs(Thing<Person> person, Jobs jobs) {
    Thing<Jobs> t = new Thing();
    t.setThingType(typeRegistry.getType(Jobs.class));
    Instant instant = Instant.now();
    t.setId(person.getKey() + "::" + instant.toString());
    t.setKey(person.getKey());/*from  ww w .  j  a v  a  2s. c om*/
    t.setValue(jobs);
    return t;
}

From source file:com.orange.cepheus.broker.persistence.SubscriptionsRepositoryTest.java

@Test
public void getAllSubscriptionsWithExceptionTest() throws SubscriptionPersistenceException {
    thrown.expect(SubscriptionPersistenceException.class);
    Instant expirationDate = Instant.now().plus(1, ChronoUnit.DAYS);
    jdbcTemplate.update("insert into t_subscriptions(id,expirationDate,subscribeContext) values(?,?,?)",
            "12345", expirationDate.toString(), "aaaaaa");
    Map<String, Subscription> subscriptions = subscriptionsRepository.getAllSubscriptions();
}

From source file:io.pivotal.strepsirrhini.chaosloris.reaper.EventReaper.java

final Mono<Long> doReap() {
    Instant limit = Instant.now().minus(this.period);

    return Flux.fromIterable(this.eventRepository.findByExecutedAtBefore(limit))
            .flatMap(event -> reap(this.eventRepository, event, this.logger)).count()
            .doOnSubscribe(s -> this.logger.info("Reap Events before {}", limit.toString()))
            .doOnSuccess(count -> this.logger.debug("Reaped {} Events", count));
}

From source file:com.orange.cepheus.broker.persistence.RegistrationsRepositoryTest.java

@Test
public void getAllRegistrationsWithExceptionTest() throws URISyntaxException, RegistrationPersistenceException {
    thrown.expect(RegistrationPersistenceException.class);
    Instant expirationDate = Instant.now().plus(1, ChronoUnit.DAYS);
    jdbcTemplate.update("insert into t_registrations(id,expirationDate,registerContext) values(?,?,?)", "12345",
            expirationDate.toString(), "aaaaaa");
    Map<String, Registration> registrations = registrationsRepository.getAllRegistrations();
}

From source file:com.orange.cepheus.broker.persistence.RegistrationsRepositoryTest.java

@Test
public void getRegistrationWithExceptionTest()
        throws URISyntaxException, RegistrationPersistenceException, EmptyResultDataAccessException {
    thrown.expect(RegistrationPersistenceException.class);
    Instant expirationDate = Instant.now().plus(1, ChronoUnit.DAYS);
    jdbcTemplate.update("insert into t_registrations(id,expirationDate,registerContext) values(?,?,?)", "12345",
            expirationDate.toString(), "aaaaaa");
    Registration foundRegistration = registrationsRepository.getRegistration("12345");
}

From source file:ws.salient.session.Session.java

public final void accept(Command request) {
    Instant instant = request.getTimestamp();
    MDC.put("sessionId", sessionId);
    MDC.put("instant", instant.toString());
    try {//from  w w  w  .  j a  v  a  2s . co m
        log.info(knowledgeBase.getJson().writeValueAsString(request));
    } catch (JsonProcessingException ex) {
    }
    long sessionTime = getClock().getCurrentTime();
    long advanceTime = instant.toEpochMilli() - sessionTime;
    getClock().advanceTime(advanceTime, TimeUnit.MILLISECONDS);
    ksession.fireAllRules();
    if (request instanceof Insert) {
        Insert insert = (Insert) request;
        ArrayNode inserts = insert.getObjects();
        List objects = inserts(inserts);
        insertAll(objects);
    } else if (request instanceof CompleteWorkItem) {
        CompleteWorkItem workItem = (CompleteWorkItem) request;
        Long workItemId = workItem.getWorkItemId();
        Map<String, ?> source = workItem.getResult();
        completeWorkItem(workItemId, source);
    } else if (request instanceof AbortWorkItem) {
        AbortWorkItem workItem = (AbortWorkItem) request;
        Long workItemId = workItem.getWorkItemId();
        ksession.getWorkItemManager().abortWorkItem(workItemId);
    } else if (request instanceof WorkItemException) {
        WorkItemException workItem = (WorkItemException) request;
        Long workItemId = workItem.getWorkItemId();
        Exception exception = workItem.getException();
        handleException(workItemId, exception);
    }
    if (eventCounter != null) {
        eventCounter.incrementAndGet();
    }
}