Example usage for java.time LocalDateTime of

List of usage examples for java.time LocalDateTime of

Introduction

In this page you can find the example usage for java.time LocalDateTime of.

Prototype

public static LocalDateTime of(LocalDate date, LocalTime time) 

Source Link

Document

Obtains an instance of LocalDateTime from a date and time.

Usage

From source file:org.jgrades.lic.app.utils.LicenceBuilder.java

public LicenceBuilder withEndOfValid(LocalDate toDateTime) {
    if (Optional.ofNullable(toDateTime).isPresent() && !StringUtils.isEmpty(toDateTime.toString())) {
        product.setValidTo(LocalDateTime.of(toDateTime, LocalTime.of(0, 0)));
    }//from  w w w.  ja  va  2s.  c  o m
    return this;
}

From source file:org.jgrades.lic.app.utils.LicenceBuilderTest.java

private Product getExampleProduct() {
    Product product = new Product();
    product.setName("prodName");
    product.setVersion("prodVersion");
    product.setValidFrom(LocalDateTime.of(start, LocalTime.of(0, 0)));
    product.setValidTo(LocalDateTime.of(stop, LocalTime.of(0, 0)));
    return product;
}

From source file:org.optaplanner.examples.conferencescheduling.persistence.ConferenceSchedulingGenerator.java

private void createTimeslotList(ConferenceSolution solution, int timeslotListSize) {
    List<Timeslot> timeslotList = new ArrayList<>(timeslotListSize);
    int timeslotOptionsIndex = 0;
    LocalDate day = timeslotFirstDay;
    for (int i = 0; i < timeslotListSize; i++) {
        Timeslot timeslot = new Timeslot();
        timeslot.setId((long) i);
        if (timeslotOptionsIndex >= timeslotOptions.size()) {
            timeslotOptionsIndex = 0;/*from  w  ww  .j  a v  a  2s  .  co m*/
            day = day.plusDays(1);
        }
        Pair<LocalTime, LocalTime> pair = timeslotOptions.get(timeslotOptionsIndex);
        timeslot.setStartDateTime(LocalDateTime.of(day, pair.getLeft()));
        timeslot.setEndDateTime(LocalDateTime.of(day, pair.getRight()));
        TalkType talkType = timeslot.getDurationInMinutes() >= 120 ? labTalkType : breakoutTalkType;
        talkType.getCompatibleTimeslotSet().add(timeslot);
        timeslot.setTalkTypeSet(Collections.singleton(talkType));
        timeslotOptionsIndex++;
        Set<String> tagSet = new LinkedHashSet<>(2);
        timeslot.setTagSet(tagSet);
        logger.trace("Created timeslot ({}) with tags ({}).", timeslot, tagSet);
        timeslotList.add(timeslot);
    }
    solution.setTimeslotList(timeslotList);
}