org.joda.time.YearMonth.withFieldAdded()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(13.3k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.joda.time.YearMonth.withFieldAdded()方法的一些代码示例,展示了YearMonth.withFieldAdded()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonth.withFieldAdded()方法的具体详情如下:
包路径:org.joda.time.YearMonth
类名称:YearMonth
方法名:withFieldAdded

YearMonth.withFieldAdded介绍

[英]Returns a copy of this year-month with the value of the specified field increased.

If the addition is zero, then this is returned.

These three lines are equivalent:

YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6); 
YearMonth added = ym.plusMonths(6); 
YearMonth added = ym.monthOfYear().addToCopy(6);

[中]返回指定字段值增加的本年月份的副本。
如果加法为零,则返回this
这三条线是等效的:

YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6); 
YearMonth added = ym.plusMonths(6); 
YearMonth added = ym.monthOfYear().addToCopy(6);

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this year-month plus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.plus(Period.months(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * </pre>
 *
 * @param months  the amount of months to add, may be negative
 * @return the new year-month plus the increased months, never null
 */
public YearMonth plusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), months);
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this year-month plus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusYears(6);
 * YearMonth added = ym.plus(Period.years(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.years(), 6);
 * </pre>
 *
 * @param years  the amount of years to add, may be negative
 * @return the new year-month plus the increased years, never null
 */
public YearMonth plusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), years);
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this year-month plus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusYears(6);
 * YearMonth added = ym.plus(Period.years(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.years(), 6);
 * </pre>
 *
 * @param years  the amount of years to add, may be negative
 * @return the new year-month plus the increased years, never null
 */
public YearMonth plusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), years);
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this year-month plus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.plus(Period.months(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * </pre>
 *
 * @param months  the amount of months to add, may be negative
 * @return the new year-month plus the increased months, never null
 */
public YearMonth plusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), months);
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this year-month minus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusMonths(6);
 * YearMonth subtracted = ym.minus(Period.months(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.months(), -6);
 * </pre>
 *
 * @param months  the amount of months to subtract, may be negative
 * @return the new year-month minus the increased months, never null
 */
public YearMonth minusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this year-month minus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusYears(6);
 * YearMonth subtracted = ym.minus(Period.years(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.years(), -6);
 * </pre>
 *
 * @param years  the amount of years to subtract, may be negative
 * @return the new year-month minus the increased years, never null
 */
public YearMonth minusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), FieldUtils.safeNegate(years));
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this year-month minus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusYears(6);
 * YearMonth subtracted = ym.minus(Period.years(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.years(), -6);
 * </pre>
 *
 * @param years  the amount of years to subtract, may be negative
 * @return the new year-month minus the increased years, never null
 */
public YearMonth minusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), FieldUtils.safeNegate(years));
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this year-month minus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusMonths(6);
 * YearMonth subtracted = ym.minus(Period.months(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.months(), -6);
 * </pre>
 *
 * @param months  the amount of months to subtract, may be negative
 * @return the new year-month minus the increased months, never null
 */
public YearMonth minusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Returns a copy of this year-month plus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.plus(Period.months(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * </pre>
 *
 * @param months  the amount of months to add, may be negative
 * @return the new year-month plus the increased months, never null
 */
public YearMonth plusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), months);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Returns a copy of this year-month plus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusYears(6);
 * YearMonth added = ym.plus(Period.years(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.years(), 6);
 * </pre>
 *
 * @param years  the amount of years to add, may be negative
 * @return the new year-month plus the increased years, never null
 */
public YearMonth plusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), years);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Returns a copy of this year-month minus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusYears(6);
 * YearMonth subtracted = ym.minus(Period.years(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.years(), -6);
 * </pre>
 *
 * @param years  the amount of years to subtract, may be negative
 * @return the new year-month minus the increased years, never null
 */
public YearMonth minusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), FieldUtils.safeNegate(years));
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Returns a copy of this year-month minus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusMonths(6);
 * YearMonth subtracted = ym.minus(Period.months(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.months(), -6);
 * </pre>
 *
 * @param months  the amount of months to subtract, may be negative
 * @return the new year-month minus the increased months, never null
 */
public YearMonth minusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Returns a copy of this year-month plus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusYears(6);
 * YearMonth added = ym.plus(Period.years(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.years(), 6);
 * </pre>
 *
 * @param years  the amount of years to add, may be negative
 * @return the new year-month plus the increased years, never null
 */
public YearMonth plusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), years);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Returns a copy of this year-month plus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.plus(Period.months(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * </pre>
 *
 * @param months  the amount of months to add, may be negative
 * @return the new year-month plus the increased months, never null
 */
public YearMonth plusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), months);
}

代码示例来源:origin: Nextdoor/bender

/**
 * Returns a copy of this year-month plus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.plus(Period.months(6));
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * </pre>
 *
 * @param months  the amount of months to add, may be negative
 * @return the new year-month plus the increased months, never null
 */
public YearMonth plusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), months);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Returns a copy of this year-month minus the specified number of years.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusYears(6);
 * YearMonth subtracted = ym.minus(Period.years(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.years(), -6);
 * </pre>
 *
 * @param years  the amount of years to subtract, may be negative
 * @return the new year-month minus the increased years, never null
 */
public YearMonth minusYears(int years) {
  return withFieldAdded(DurationFieldType.years(), FieldUtils.safeNegate(years));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Returns a copy of this year-month minus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusMonths(6);
 * YearMonth subtracted = ym.minus(Period.months(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.months(), -6);
 * </pre>
 *
 * @param months  the amount of months to subtract, may be negative
 * @return the new year-month minus the increased months, never null
 */
public YearMonth minusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Returns a copy of this year-month minus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusMonths(6);
 * YearMonth subtracted = ym.minus(Period.months(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.months(), -6);
 * </pre>
 *
 * @param months  the amount of months to subtract, may be negative
 * @return the new year-month minus the increased months, never null
 */
public YearMonth minusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Returns a copy of this year-month minus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusMonths(6);
 * YearMonth subtracted = ym.minus(Period.months(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.months(), -6);
 * </pre>
 *
 * @param months  the amount of months to subtract, may be negative
 * @return the new year-month minus the increased months, never null
 */
public YearMonth minusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Returns a copy of this year-month minus the specified number of months.
 * <p>
 * This year-month instance is immutable and unaffected by this method call.
 * <p>
 * The following three lines are identical in effect:
 * <pre>
 * YearMonth subtracted = ym.minusMonths(6);
 * YearMonth subtracted = ym.minus(Period.months(6));
 * YearMonth subtracted = ym.withFieldAdded(DurationFieldType.months(), -6);
 * </pre>
 *
 * @param months  the amount of months to subtract, may be negative
 * @return the new year-month minus the increased months, never null
 */
public YearMonth minusMonths(int months) {
  return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}

相关文章