本文整理汇总了Java中java.time.calendrical.DateTime.WithAdjuster类的典型用法代码示例。如果您正苦于以下问题:Java WithAdjuster类的具体用法?Java WithAdjuster怎么用?Java WithAdjuster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WithAdjuster类属于java.time.calendrical.DateTime包,在下文中一共展示了WithAdjuster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: with
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public ChronoDateTimeImpl<C> with(WithAdjuster adjuster) {
if (adjuster instanceof ChronoLocalDate) {
// The Chrono is checked in with(date,time)
return with((ChronoLocalDate<C>) adjuster, this.time);
} else if (adjuster instanceof LocalTime) {
return with(this.date, (LocalTime) adjuster);
} else if (adjuster instanceof ChronoDateTimeImpl) {
return this.date.getChrono().ensureChronoLocalDateTime((ChronoDateTimeImpl<?>) adjuster);
}
return this.date.getChrono().ensureChronoLocalDateTime(adjuster.doWithAdjustment(this));
}
示例2: test_with_adjustment
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "tck" })
public void test_with_adjustment() {
final OffsetDateTime sample = OffsetDateTime.of(2012, 3, 4, 23, 5, OFFSET_PONE);
WithAdjuster adjuster = new WithAdjuster() {
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
return sample;
}
};
assertEquals(this.TEST_2008_6_30_11_30_59_000000500.with(adjuster), sample);
}
示例3: test_with_adjustment
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "tck" })
public void test_with_adjustment() {
final LocalDateTime sample = LocalDateTime.of(2012, 3, 4, 23, 5);
WithAdjuster adjuster = new WithAdjuster() {
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
return sample;
}
};
assertEquals(this.TEST_2007_07_15_12_30_40_987654321.with(adjuster), sample);
}
示例4: test_with_adjustment
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "tck" })
public void test_with_adjustment() {
final LocalDate sample = LocalDate.of(2012, 3, 4);
WithAdjuster adjuster = new WithAdjuster() {
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
return sample;
}
};
assertEquals(this.TEST_2007_07_15.with(adjuster), sample);
}
示例5: test_with_adjustment
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "tck" })
public void test_with_adjustment() {
final LocalTime sample = LocalTime.of(23, 5);
WithAdjuster adjuster = new WithAdjuster() {
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
return sample;
}
};
assertEquals(this.TEST_12_30_40_987654321.with(adjuster), sample);
}
示例6: test_with_adjustment
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "tck" })
public void test_with_adjustment() {
final OffsetDate sample = OffsetDate.of(2012, 3, 4, OFFSET_PONE);
WithAdjuster adjuster = new WithAdjuster() {
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
return sample;
}
};
assertEquals(this.TEST_2007_07_15_PONE.with(adjuster), sample);
}
示例7: test_with_adjustment
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "tck" })
public void test_with_adjustment() {
final OffsetTime sample = OffsetTime.of(23, 5, OFFSET_PONE);
WithAdjuster adjuster = new WithAdjuster() {
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
return sample;
}
};
assertEquals(this.TEST_11_30_59_500_PONE.with(adjuster), sample);
}
示例8: test_with_adjustment_AmPm
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "tck" })
public void test_with_adjustment_AmPm() {
OffsetTime test = this.TEST_11_30_59_500_PONE.with(new WithAdjuster() {
@Override
public DateTime doWithAdjustment(DateTime dateTime) {
return dateTime.with(HOUR_OF_DAY, 23);
}
});
assertEquals(test, OffsetTime.of(23, 30, 59, 500, OFFSET_PONE));
}
示例9: test_interfaces
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "implementation" })
public void test_interfaces() {
Object obj = this.TEST_07_15;
assertTrue(obj instanceof Serializable);
assertTrue(obj instanceof Comparable<?>);
assertTrue(obj instanceof WithAdjuster);
}
示例10: test_interfaces
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "implementation" })
public void test_interfaces() {
assertTrue(Serializable.class.isAssignableFrom(Year.class));
assertTrue(Comparable.class.isAssignableFrom(Year.class));
assertTrue(WithAdjuster.class.isAssignableFrom(Year.class));
}
示例11: test_interfaces
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(groups = { "implementation" })
public void test_interfaces() {
Object obj = this.TEST_2008_06;
assertTrue(obj instanceof Serializable);
assertTrue(obj instanceof Comparable<?>);
assertTrue(obj instanceof WithAdjuster);
}
示例12: with
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Override
public Instant with(WithAdjuster adjuster) {
return (Instant) adjuster.doWithAdjustment(this);
}
示例13: with
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Override
ChronoLocalDate<C> with(WithAdjuster adjuster);
示例14: with
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Override
ChronoLocalDateTime<C> with(WithAdjuster adjuster);
示例15: test_with_WithAdjuster_null
import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Test(expectedExceptions = NullPointerException.class, groups = { "tck" })
public void test_with_WithAdjuster_null() {
ZonedDateTime base = ZonedDateTime.of(this.TEST_LOCAL_2008_06_30_11_30_59_500, ZONE_0100);
base.with((WithAdjuster) null);
}