當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalDate.atTime方法代碼示例

本文整理匯總了Java中java.time.LocalDate.atTime方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalDate.atTime方法的具體用法?Java LocalDate.atTime怎麽用?Java LocalDate.atTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.LocalDate的用法示例。


在下文中一共展示了LocalDate.atTime方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getReservations

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public Set<Reservation> getReservations(String venue, LocalDate date, LocalTime startTime, Duration duration) {
	// Let's start from an implementation of the simplest linear searh algorithm
	LocalDateTime startDateTime = date.atTime(startTime);
	LocalDateTime endDateTime = startDateTime.plus(duration);
	return getVenueReservations(venue).filter(conflictReservation -> {
		LocalDateTime conflictStartDateTime = conflictReservation.getDate().atTime(conflictReservation.getStartTime());
		LocalDateTime conflictEndDateTime = conflictStartDateTime.plus(conflictReservation.getDuration());
		return startDateTime.isEqual(conflictStartDateTime)
				|| isInBetween(startDateTime, conflictStartDateTime, conflictEndDateTime) 
				|| isInBetween(endDateTime, conflictStartDateTime, conflictEndDateTime)
				|| isInBetween(conflictStartDateTime, startDateTime, endDateTime)
				|| isInBetween(conflictEndDateTime, startDateTime, endDateTime);
	}).collect(toSet());
}
 
開發者ID:samolisov,項目名稱:bluemix-liberty-microprofile-demo,代碼行數:16,代碼來源:HashMapReservationDao.java

示例2: testIsInBetweenLeftPlusASecond

import java.time.LocalDate; //導入方法依賴的package包/類
@Test
public void testIsInBetweenLeftPlusASecond() throws Exception {
	LocalDateTime leftDateTime = LEFT_DATE.atTime(LEFT_TIME);				

	LocalTime testTime = LEFT_TIME.plusSeconds(1);
	LocalDate testDate = LEFT_DATE;
	LocalDateTime testDateTime = testDate.atTime(testTime);
	
	LocalDateTime rightDateTime = RIGHT_DATE.atTime(RIGHT_TIME);
		
	assertTrue("testDateTime is expected in between leftDateTime and rightDateTime", 
		reservationDao.isInBetween(testDateTime, leftDateTime, rightDateTime));		
}
 
開發者ID:samolisov,項目名稱:bluemix-liberty-microprofile-demo,代碼行數:14,代碼來源:HashMapReservationDaoTest.java

示例3: format

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public boolean format(DateTimePrintContext context, StringBuilder buf) {
    ZoneId zone = context.getValue(TemporalQueries.zoneId());
    if (zone == null) {
        return false;
    }
    String zname = zone.getId();
    if (!(zone instanceof ZoneOffset)) {
        TemporalAccessor dt = context.getTemporal();
        int type = GENERIC;
        if (!isGeneric) {
            if (dt.isSupported(ChronoField.INSTANT_SECONDS)) {
                type = zone.getRules().isDaylightSavings(Instant.from(dt)) ? DST : STD;
            } else if (dt.isSupported(ChronoField.EPOCH_DAY) &&
                       dt.isSupported(ChronoField.NANO_OF_DAY)) {
                LocalDate date = LocalDate.ofEpochDay(dt.getLong(ChronoField.EPOCH_DAY));
                LocalTime time = LocalTime.ofNanoOfDay(dt.getLong(ChronoField.NANO_OF_DAY));
                LocalDateTime ldt = date.atTime(time);
                if (zone.getRules().getTransition(ldt) == null) {
                    type = zone.getRules().isDaylightSavings(ldt.atZone(zone).toInstant()) ? DST : STD;
                }
            }
        }
        String name = getDisplayName(zname, type, context.getLocale());
        if (name != null) {
            zname = name;
        }
    }
    buf.append(zname);
    return true;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:DateTimeFormatterBuilder.java

示例4: test_atTime_int_int_int_int_secondTooBig

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_secondTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 30, 60, 50);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKLocalDate.java

示例5: create

import java.time.LocalDate; //導入方法依賴的package包/類
static DateTimeParameterObject create(final LocalDate localDate, @Nullable final String pattern) {
	final LocalDateTime localDateTime = localDate.atTime(LocalTime.MIN);
	return new DateTimeParameterObject(localDateTime, pattern);
}
 
開發者ID:rooting-company,項目名稱:roxana,代碼行數:5,代碼來源:DateTimeParameterObject.java

示例6: test_atTime_int_int_int_int_nanoTooBig

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_nanoTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 30, 40, 1000000000);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKLocalDate.java

示例7: test_atTime_LocalTime_null

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=NullPointerException.class)
public void test_atTime_LocalTime_null() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime((LocalTime) null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKLocalDate.java

示例8: test_atTime_int_int_int_secondTooBig

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_secondTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 30, 60);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKLocalDate.java

示例9: test_atTime_int_int_int_int_hourTooSmall

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_hourTooSmall() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(-1, 30, 40, 50);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKLocalDate.java

示例10: test_atTime_int_int_minuteTooBig

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_minuteTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 60);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKLocalDate.java

示例11: test_atTime_int_int_int_int_minuteTooBig

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_minuteTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 60, 40, 50);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKLocalDate.java

示例12: test_atTime_int_int_int_hourTooSmall

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_hourTooSmall() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(-1, 30, 40);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKLocalDate.java

示例13: test_atTime_int_int_int_hourTooBig

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_hourTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(24, 30, 40);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKLocalDate.java

示例14: test_atTime_int_int_int_int_secondTooSmall

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_int_secondTooSmall() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 30, -1, 50);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKLocalDate.java

示例15: test_atTime_int_int_int_minuteTooBig

import java.time.LocalDate; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_atTime_int_int_int_minuteTooBig() {
    LocalDate t = LocalDate.of(2008, 6, 30);
    t.atTime(11, 60, 40);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKLocalDate.java


注:本文中的java.time.LocalDate.atTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。