本文整理匯總了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());
}
示例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));
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}