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

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

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

YearMonth.getField介绍

[英]Gets the field for a specific index in the chronology specified.

This method must not use any instance variables.
[中]

代码示例

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Returns a copy of this year-month with the value of the specified field increased.
  3. * <p>
  4. * If the addition is zero, then <code>this</code> is returned.
  5. * <p>
  6. * These three lines are equivalent:
  7. * <pre>
  8. * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
  9. * YearMonth added = ym.plusMonths(6);
  10. * YearMonth added = ym.monthOfYear().addToCopy(6);
  11. * </pre>
  12. *
  13. * @param fieldType the field type to add to, not null
  14. * @param amount the amount to add
  15. * @return a copy of this instance with the field updated, never null
  16. * @throws IllegalArgumentException if the value is null or invalid
  17. * @throws ArithmeticException if the new date-time exceeds the capacity
  18. */
  19. public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  20. int index = indexOfSupported(fieldType);
  21. if (amount == 0) {
  22. return this;
  23. }
  24. int[] newValues = getValues();
  25. newValues = getField(index).add(this, index, newValues, amount);
  26. return new YearMonth(this, newValues);
  27. }

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

  1. /**
  2. * Returns a copy of this year-month with the value of the specified field increased.
  3. * <p>
  4. * If the addition is zero, then <code>this</code> is returned.
  5. * <p>
  6. * These three lines are equivalent:
  7. * <pre>
  8. * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
  9. * YearMonth added = ym.plusMonths(6);
  10. * YearMonth added = ym.monthOfYear().addToCopy(6);
  11. * </pre>
  12. *
  13. * @param fieldType the field type to add to, not null
  14. * @param amount the amount to add
  15. * @return a copy of this instance with the field updated, never null
  16. * @throws IllegalArgumentException if the value is null or invalid
  17. * @throws ArithmeticException if the new date-time exceeds the capacity
  18. */
  19. public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  20. int index = indexOfSupported(fieldType);
  21. if (amount == 0) {
  22. return this;
  23. }
  24. int[] newValues = getValues();
  25. newValues = getField(index).add(this, index, newValues, amount);
  26. return new YearMonth(this, newValues);
  27. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified field set to a new value.
  3. * <p>
  4. * For example, if the field type is <code>monthOfYear</code> then the month
  5. * would be changed in the returned instance.
  6. * <p>
  7. * These three lines are equivalent:
  8. * <pre>
  9. * YearMonth updated = ym.withField(DateTimeFieldType.monthOfYear(), 6);
  10. * YearMonth updated = ym.monthOfYear().setCopy(6);
  11. * YearMonth updated = ym.property(DateTimeFieldType.monthOfYear()).setCopy(6);
  12. * </pre>
  13. *
  14. * @param fieldType the field type to set, not null
  15. * @param value the value to set
  16. * @return a copy of this instance with the field set, never null
  17. * @throws IllegalArgumentException if the value is null or invalid
  18. */
  19. public YearMonth withField(DateTimeFieldType fieldType, int value) {
  20. int index = indexOfSupported(fieldType);
  21. if (value == getValue(index)) {
  22. return this;
  23. }
  24. int[] newValues = getValues();
  25. newValues = getField(index).set(this, index, newValues, value);
  26. return new YearMonth(this, newValues);
  27. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified field set to a new value.
  3. * <p>
  4. * For example, if the field type is <code>monthOfYear</code> then the month
  5. * would be changed in the returned instance.
  6. * <p>
  7. * These three lines are equivalent:
  8. * <pre>
  9. * YearMonth updated = ym.withField(DateTimeFieldType.monthOfYear(), 6);
  10. * YearMonth updated = ym.monthOfYear().setCopy(6);
  11. * YearMonth updated = ym.property(DateTimeFieldType.monthOfYear()).setCopy(6);
  12. * </pre>
  13. *
  14. * @param fieldType the field type to set, not null
  15. * @param value the value to set
  16. * @return a copy of this instance with the field set, never null
  17. * @throws IllegalArgumentException if the value is null or invalid
  18. */
  19. public YearMonth withField(DateTimeFieldType fieldType, int value) {
  20. int index = indexOfSupported(fieldType);
  21. if (value == getValue(index)) {
  22. return this;
  23. }
  24. int[] newValues = getValues();
  25. newValues = getField(index).set(this, index, newValues, value);
  26. return new YearMonth(this, newValues);
  27. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. int index = indexOf(fieldType);
  2. if (index >= 0) {
  3. newValues = getField(index).add(this, index, newValues,
  4. FieldUtils.safeMultiply(period.getValue(i), scalar));

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

  1. int index = indexOf(fieldType);
  2. if (index >= 0) {
  3. newValues = getField(index).add(this, index, newValues,
  4. FieldUtils.safeMultiply(period.getValue(i), scalar));

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

  1. /**
  2. * Returns a copy of this year-month with the value of the specified field increased.
  3. * <p>
  4. * If the addition is zero, then <code>this</code> is returned.
  5. * <p>
  6. * These three lines are equivalent:
  7. * <pre>
  8. * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
  9. * YearMonth added = ym.plusMonths(6);
  10. * YearMonth added = ym.monthOfYear().addToCopy(6);
  11. * </pre>
  12. *
  13. * @param fieldType the field type to add to, not null
  14. * @param amount the amount to add
  15. * @return a copy of this instance with the field updated, never null
  16. * @throws IllegalArgumentException if the value is null or invalid
  17. * @throws ArithmeticException if the new date-time exceeds the capacity
  18. */
  19. public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  20. int index = indexOfSupported(fieldType);
  21. if (amount == 0) {
  22. return this;
  23. }
  24. int[] newValues = getValues();
  25. newValues = getField(index).add(this, index, newValues, amount);
  26. return new YearMonth(this, newValues);
  27. }

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

  1. /**
  2. * Returns a copy of this year-month with the specified field set to a new value.
  3. * <p>
  4. * For example, if the field type is <code>monthOfYear</code> then the month
  5. * would be changed in the returned instance.
  6. * <p>
  7. * These three lines are equivalent:
  8. * <pre>
  9. * YearMonth updated = ym.withField(DateTimeFieldType.monthOfYear(), 6);
  10. * YearMonth updated = ym.monthOfYear().setCopy(6);
  11. * YearMonth updated = ym.property(DateTimeFieldType.monthOfYear()).setCopy(6);
  12. * </pre>
  13. *
  14. * @param fieldType the field type to set, not null
  15. * @param value the value to set
  16. * @return a copy of this instance with the field set, never null
  17. * @throws IllegalArgumentException if the value is null or invalid
  18. */
  19. public YearMonth withField(DateTimeFieldType fieldType, int value) {
  20. int index = indexOfSupported(fieldType);
  21. if (value == getValue(index)) {
  22. return this;
  23. }
  24. int[] newValues = getValues();
  25. newValues = getField(index).set(this, index, newValues, value);
  26. return new YearMonth(this, newValues);
  27. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. /**
  2. * Gets the field that this property uses.
  3. *
  4. * @return the field
  5. */
  6. public DateTimeField getField() {
  7. return iBase.getField(iFieldIndex);
  8. }

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

  1. int index = indexOf(fieldType);
  2. if (index >= 0) {
  3. newValues = getField(index).add(this, index, newValues,
  4. FieldUtils.safeMultiply(period.getValue(i), scalar));

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

  1. /**
  2. * Returns a copy of this year-month with the value of the specified field increased.
  3. * <p>
  4. * If the addition is zero, then <code>this</code> is returned.
  5. * <p>
  6. * These three lines are equivalent:
  7. * <pre>
  8. * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
  9. * YearMonth added = ym.plusMonths(6);
  10. * YearMonth added = ym.monthOfYear().addToCopy(6);
  11. * </pre>
  12. *
  13. * @param fieldType the field type to add to, not null
  14. * @param amount the amount to add
  15. * @return a copy of this instance with the field updated, never null
  16. * @throws IllegalArgumentException if the value is null or invalid
  17. * @throws ArithmeticException if the new date-time exceeds the capacity
  18. */
  19. public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  20. int index = indexOfSupported(fieldType);
  21. if (amount == 0) {
  22. return this;
  23. }
  24. int[] newValues = getValues();
  25. newValues = getField(index).add(this, index, newValues, amount);
  26. return new YearMonth(this, newValues);
  27. }

相关文章