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


Java DateTime.with方法代码示例

本文整理汇总了Java中java.time.calendrical.DateTime.with方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.with方法的具体用法?Java DateTime.with怎么用?Java DateTime.with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.calendrical.DateTime的用法示例。


在下文中一共展示了DateTime.with方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doWithAdjustment

import java.time.calendrical.DateTime; //导入方法依赖的package包/类
@Override
public DateTime doWithAdjustment(DateTime dateTime) {

  return dateTime.with(NANO_OF_DAY, toNanoOfDay());
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:6,代码来源:LocalTime.java

示例2: doWithAdjustment

import java.time.calendrical.DateTime; //导入方法依赖的package包/类
@Override
public DateTime doWithAdjustment(DateTime dateTime) {

  return dateTime.with(EPOCH_DAY, toEpochDay());
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:6,代码来源:DefaultInterfaceChronoLocalDate.java

示例3: doWithAdjustment

import java.time.calendrical.DateTime; //导入方法依赖的package包/类
@Override
public DateTime doWithAdjustment(DateTime dateTime) {

  return dateTime.with(OFFSET_SECONDS, this.totalSeconds);
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:6,代码来源:ZoneOffset.java

示例4: doWithAdjustment

import java.time.calendrical.DateTime; //导入方法依赖的package包/类
@Override
public DateTime doWithAdjustment(DateTime dateTime) {

  return dateTime.with(ERA, getValue());
}
 
开发者ID:m-m-m,项目名称:java8-backports,代码行数:6,代码来源:DefaultInterfaceEra.java

示例5: doWithAdjustment

import java.time.calendrical.DateTime; //导入方法依赖的package包/类
/**
 * Implementation of the strategy to make an adjustment to the specified date-time object.
 * <p>
 * This method is not intended to be called by application code directly. Applications should use the
 * {@code with(WithAdjuster)} method on the date-time object to make the adjustment passing this as the
 * argument.
 * <p>
 * This instance is immutable and unaffected by this method call.
 * 
 * <h4>Implementation notes</h4>
 * Adjusts the specified date-time to have the value of this year-month. The date-time object must use the
 * ISO calendar system. The adjustment is equivalent to using {@link DateTime#with(DateTimeField, long)}
 * passing {@code EPOCH_MONTH} as the field.
 * 
 * @param dateTime the target object to be adjusted, not null
 * @return the adjusted object, not null
 */
@Override
public DateTime doWithAdjustment(DateTime dateTime) {

  if (Chrono.from(dateTime).equals(ISOChrono.INSTANCE) == false) {
    throw new DateTimeException("Adjustment only supported on ISO date-time");
  }
  return dateTime.with(EPOCH_MONTH, getEpochMonth());
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:26,代码来源:YearMonth.java

示例6: doWithAdjustment

import java.time.calendrical.DateTime; //导入方法依赖的package包/类
/**
 * Implementation of the strategy to make an adjustment to the specified date-time object.
 * <p>
 * This method is not intended to be called by application code directly. Applications should use the
 * {@code with(WithAdjuster)} method on the date-time object to make the adjustment passing this as the
 * argument.
 * <p>
 * This instance is immutable and unaffected by this method call.
 * 
 * <h4>Implementation notes</h4>
 * Adjusts the specified date-time to have the value of this month-day. The date-time object must use the
 * ISO calendar system. The adjustment is equivalent to using {@link DateTime#with(DateTimeField, long)}
 * twice passing {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} as the fields.
 * 
 * @param dateTime the target object to be adjusted, not null
 * @return the adjusted object, not null
 */
@Override
public DateTime doWithAdjustment(DateTime dateTime) {

  if (Chrono.from(dateTime).equals(ISOChrono.INSTANCE) == false) {
    throw new DateTimeException("Adjustment only supported on ISO date-time");
  }
  dateTime = dateTime.with(MONTH_OF_YEAR, this.month);
  return dateTime.with(DAY_OF_MONTH, Math.min(dateTime.range(DAY_OF_MONTH).getMaximum(), this.day));
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:27,代码来源:MonthDay.java

示例7: doWithAdjustment

import java.time.calendrical.DateTime; //导入方法依赖的package包/类
/**
 * Implementation of the strategy to make an adjustment to the specified date-time object.
 * <p>
 * This method is not intended to be called by application code directly. Applications should use the
 * {@code with(WithAdjuster)} method on the date-time object to make the adjustment passing this as the
 * argument.
 * <p>
 * This instance is immutable and unaffected by this method call.
 * 
 * <h4>Implementation notes</h4>
 * Adjusts the specified date-time to have the value of this year. The date-time object must use the ISO
 * calendar system. The adjustment is equivalent to using {@link DateTime#with(DateTimeField, long)} passing
 * {@code YEAR} as the field.
 * 
 * @param dateTime the target object to be adjusted, not null
 * @return the adjusted object, not null
 */
@Override
public DateTime doWithAdjustment(DateTime dateTime) {

  if (Chrono.from(dateTime).equals(ISOChrono.INSTANCE) == false) {
    throw new DateTimeException("Adjustment only supported on ISO date-time");
  }
  return dateTime.with(YEAR, this.year);
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:26,代码来源:Year.java


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