当前位置: 首页>>代码示例>>Java>>正文


Java WithAdjuster类代码示例

本文整理汇总了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));
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:15,代码来源:ChronoDateTimeImpl.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:15,代码来源:TCKOffsetDateTime.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:15,代码来源:TCKLocalDateTime.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:15,代码来源:TCKLocalDate.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:15,代码来源:TCKLocalTime.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:15,代码来源:TCKOffsetDate.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:15,代码来源:TCKOffsetTime.java

示例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));
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:14,代码来源:TCKOffsetTime.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:9,代码来源:TestMonthDay.java

示例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));
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:8,代码来源:TestYear.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:9,代码来源:TestYearMonth.java

示例12: with

import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Override
public Instant with(WithAdjuster adjuster) {

  return (Instant) adjuster.doWithAdjustment(this);
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:6,代码来源:Instant.java

示例13: with

import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Override
ChronoLocalDate<C> with(WithAdjuster adjuster);
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:3,代码来源:ChronoLocalDate.java

示例14: with

import java.time.calendrical.DateTime.WithAdjuster; //导入依赖的package包/类
@Override
ChronoLocalDateTime<C> with(WithAdjuster adjuster);
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:3,代码来源:ChronoLocalDateTime.java

示例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);
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:7,代码来源:TCKZonedDateTime.java


注:本文中的java.time.calendrical.DateTime.WithAdjuster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。