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

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

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

YearMonth.withPeriodAdded介绍

[英]Returns a copy of this year-month with the specified period added.

If the addition is zero, then this is returned. Fields in the period that aren't present in the partial are ignored.

This method is typically used to add multiple copies of complex period instances. Adding one field is best achieved using methods like #withFieldAdded(DurationFieldType,int)or #plusYears(int).
[中]返回添加了指定期间的本年月份的副本。
如果加法为零,则返回this。将忽略部分字段中不存在的期间字段。
此方法通常用于添加复杂时段实例的多个副本。添加一个字段最好使用#withFieldAdded(DurationFieldType,int)或#plusYears(int)等方法。

代码示例

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

代码示例来源:origin: io.virtdata/virtdata-lib-realer

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

代码示例来源:origin: io.virtdata/virtdata-lib-realer

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period added.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add complex period instances.
  7. * Adding one field is best achieved using methods
  8. * like {@link #plusYears(int)}.
  9. *
  10. * @param period the duration to add to this one, null means zero
  11. * @return a copy of this instance with the period added, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth plus(ReadablePeriod period) {
  15. return withPeriodAdded(period, 1);
  16. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified period taken away.
  3. * <p>
  4. * If the amount is zero or null, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to subtract complex period instances.
  7. * Subtracting one field is best achieved using methods
  8. * like {@link #minusYears(int)}.
  9. *
  10. * @param period the period to reduce this instant by
  11. * @return a copy of this instance with the period taken away, never null
  12. * @throws ArithmeticException if the new year-month exceeds the capacity
  13. */
  14. public YearMonth minus(ReadablePeriod period) {
  15. return withPeriodAdded(period, -1);
  16. }

相关文章