Example usage for java.time LocalDate parse

List of usage examples for java.time LocalDate parse

Introduction

In this page you can find the example usage for java.time LocalDate parse.

Prototype

public static LocalDate parse(CharSequence text) 

Source Link

Document

Obtains an instance of LocalDate from a text string such as 2007-12-03 .

Usage

From source file:ch.rasc.edsutil.jackson.ISO8601LocalDateDeserializer.java

@Override
public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    return LocalDate.parse(jp.getText());
}

From source file:svc.data.citations.datasources.tyler.TylerCitationDataSourceIntegrationTest.java

@Test
public void testCitationNumber() {
    List<Citation> citations = tylerCitationDataSource.getByCitationNumberAndDOB("", LocalDate.parse(""));

    assertNotEquals(citations.size(), 0);
    assertEquals(citations.get(0).citation_number, "120499230");
    assertEquals(citations.get(0).drivers_license_number, "337543025");
}

From source file:com.inversoft.json.LocalDateDeserializer.java

@Override
public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    return LocalDate.parse(jp.getText());
}

From source file:net.jmhertlein.mcanalytics.plugin.daemon.request.UniqueLoginsPerDayRequestHandler.java

@Override
public JSONObject handle(Connection conn, StatementProvider stmts, JSONObject request, ClientMonitor client)
        throws Exception {
    PreparedStatement stmt = conn.prepareStatement(stmts.get(SQLString.GET_UNIQUE_LOGINS));

    stmt.clearParameters();//from  w  w  w  .  ja  v a 2  s .c  o  m
    stmt.setTimestamp(1, Timestamp.valueOf(LocalDate.parse(request.getString("start")).atStartOfDay()));
    stmt.setTimestamp(2,
            Timestamp.valueOf(LocalDate.parse(request.getString("end")).plusDays(1).atStartOfDay()));
    ResultSet res = stmt.executeQuery();

    Map<String, Integer> counts = new HashMap<>();
    while (res.next()) {
        counts.put(res.getTimestamp("login_day").toLocalDateTime().toLocalDate().toString(),
                res.getInt("login_count"));
    }

    JSONObject ret = new JSONObject();
    ret.put("logins", counts);
    res.close();
    stmt.close();
    return ret;
}

From source file:svc.data.citations.datasources.tyler.TylerCitationDataSourceIntegrationTest.java

@Test
public void testDriversLicense() {
    List<Citation> citations = tylerCitationDataSource.getByLicenseAndDOB("", "", LocalDate.parse(""));

    assertNotEquals(citations.size(), 0);
    assertEquals(citations.get(0).citation_number, "120499230");
    assertEquals(citations.get(0).drivers_license_number, "337543025");
}

From source file:com.github.ibm.domino.resource.EventTime.java

public ZonedDateTime getEventDateTime() {

    String timeZone;//  w w w . ja  v a 2  s .com
    if (isUtc()) {
        timeZone = "Z";
    } else {
        timeZone = "";
    }
    if (geteTime() == null) {
        return LocalDate.parse(geteDate()).atStartOfDay(ZoneId.systemDefault());
    } else {
        return ZonedDateTime.parse(geteDate() + "T" + geteTime() + timeZone);
    }
}

From source file:com.swcguild.dvdlibraryv3.dao.DVDLibraryDaoDKTest.java

@Before
public void setUp() throws ParseException, FileNotFoundException {
    ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
    dao = ctx.getBean("dvdLibraryDao", DvdLibraryDao.class);

    a = new Dvd();
    b = new Dvd();
    c = new Dvd();

    a.setId(1);//from w  ww.j  a  va  2  s .c  o  m
    a.setTitle("Mad Max: Fury Road");
    a.setReleaseDate(LocalDate.parse("2015-05-15"));
    a.setMpaaRating("Test-R");
    a.setDirector("George Miller");
    a.setStudio("Test-Universal");
    a.setNote("okay");

    b.setId(2);
    b.setTitle("TestTitle");
    b.setReleaseDate(LocalDate.parse("2015-06-15"));
    b.setMpaaRating("Test-R");
    b.setDirector("testDir");
    b.setStudio("Test-Sony");
    b.setNote("notes b");

    c.setId(3);
    c.setTitle("AnotherTitle");
    c.setReleaseDate(LocalDate.parse("2015-07-15"));
    c.setMpaaRating("Test-R");
    c.setDirector("George Miller");
    c.setStudio("Test-Sony");
    c.setNote("notes c");

}

From source file:svc.data.citations.datasources.tyler.TylerCitationDataSourceIntegrationTest.java

@Test
public void testName() {
    List<Citation> citations = tylerCitationDataSource.getByNameAndMunicipalitiesAndDOB("", null,
            LocalDate.parse(""));

    assertNotEquals(citations.size(), 0);
    assertEquals(citations.get(0).citation_number, "120499230");
    assertEquals(citations.get(0).drivers_license_number, "337543025");
}

From source file:de.lgblaumeiser.ptm.rest.BookingRestController.java

@RequestMapping(method = RequestMethod.GET, value = "/{dayString}")
public Collection<Booking> getBookingsForDay(@PathVariable String dayString) {
    LocalDate day = LocalDate.parse(dayString);
    return services.bookingStore().retrieveAll().stream().filter(b -> b.getBookingday().equals(day))
            .sorted((b1, b2) -> b1.getStarttime().compareTo(b2.getStarttime())).collect(toList());
}

From source file:net.jmhertlein.mcanalytics.plugin.daemon.request.FirstJoinRequestHandler.java

@Override
public JSONObject handle(Connection conn, StatementProvider stmts, JSONObject request, ClientMonitor client)
        throws Exception {
    //System.out.println("Handler: starting...");
    PreparedStatement stmt = conn.prepareStatement(stmts.get(SQLString.GET_NEW_PLAYER_LOGINS_HOURLY));

    stmt.clearParameters();//from   w  ww .  ja v a  2 s .c o  m
    stmt.setTimestamp(1, Timestamp.valueOf(LocalDate.parse(request.getString("start")).atStartOfDay()));
    stmt.setTimestamp(2,
            Timestamp.valueOf(LocalDate.parse(request.getString("end")).plusDays(1).atStartOfDay()));
    ResultSet res = stmt.executeQuery();

    Map<String, Integer> counts = new HashMap<>();
    while (res.next()) {
        counts.put(res.getTimestamp("hour_joined").toLocalDateTime().toString(), res.getInt("login_count"));
    }

    JSONObject ret = new JSONObject();
    ret.put("first_login_counts", counts);
    res.close();
    stmt.close();
    //System.out.println("Handler: done, returning.");
    return ret;
}