当前位置: 首页>>代码示例>>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;未经允许,请勿转载。