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

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

本文整理了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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Returns a copy of this year-month with the value of the specified field increased.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * <p>
 * These three lines are equivalent:
 * <pre>
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.monthOfYear().addToCopy(6);
 * </pre>
 * 
 * @param fieldType  the field type to add to, not null
 * @param amount  the amount to add
 * @return a copy of this instance with the field updated, never null
 * @throws IllegalArgumentException if the value is null or invalid
 * @throws ArithmeticException if the new date-time exceeds the capacity
 */
public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  int index = indexOfSupported(fieldType);
  if (amount == 0) {
    return this;
  }
  int[] newValues = getValues();
  newValues = getField(index).add(this, index, newValues, amount);
  return new YearMonth(this, newValues);
}

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

/**
 * Returns a copy of this year-month with the value of the specified field increased.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * <p>
 * These three lines are equivalent:
 * <pre>
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.monthOfYear().addToCopy(6);
 * </pre>
 * 
 * @param fieldType  the field type to add to, not null
 * @param amount  the amount to add
 * @return a copy of this instance with the field updated, never null
 * @throws IllegalArgumentException if the value is null or invalid
 * @throws ArithmeticException if the new date-time exceeds the capacity
 */
public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  int index = indexOfSupported(fieldType);
  if (amount == 0) {
    return this;
  }
  int[] newValues = getValues();
  newValues = getField(index).add(this, index, newValues, amount);
  return new YearMonth(this, newValues);
}

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

/**
 * Returns a copy of this year-month with the specified field set to a new value.
 * <p>
 * For example, if the field type is <code>monthOfYear</code> then the month
 * would be changed in the returned instance.
 * <p>
 * These three lines are equivalent:
 * <pre>
 * YearMonth updated = ym.withField(DateTimeFieldType.monthOfYear(), 6);
 * YearMonth updated = ym.monthOfYear().setCopy(6);
 * YearMonth updated = ym.property(DateTimeFieldType.monthOfYear()).setCopy(6);
 * </pre>
 *
 * @param fieldType  the field type to set, not null
 * @param value  the value to set
 * @return a copy of this instance with the field set, never null
 * @throws IllegalArgumentException if the value is null or invalid
 */
public YearMonth withField(DateTimeFieldType fieldType, int value) {
  int index = indexOfSupported(fieldType);
  if (value == getValue(index)) {
    return this;
  }
  int[] newValues = getValues();
  newValues = getField(index).set(this, index, newValues, value);
  return new YearMonth(this, newValues);
}

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

/**
 * Returns a copy of this year-month with the specified field set to a new value.
 * <p>
 * For example, if the field type is <code>monthOfYear</code> then the month
 * would be changed in the returned instance.
 * <p>
 * These three lines are equivalent:
 * <pre>
 * YearMonth updated = ym.withField(DateTimeFieldType.monthOfYear(), 6);
 * YearMonth updated = ym.monthOfYear().setCopy(6);
 * YearMonth updated = ym.property(DateTimeFieldType.monthOfYear()).setCopy(6);
 * </pre>
 *
 * @param fieldType  the field type to set, not null
 * @param value  the value to set
 * @return a copy of this instance with the field set, never null
 * @throws IllegalArgumentException if the value is null or invalid
 */
public YearMonth withField(DateTimeFieldType fieldType, int value) {
  int index = indexOfSupported(fieldType);
  if (value == getValue(index)) {
    return this;
  }
  int[] newValues = getValues();
  newValues = getField(index).set(this, index, newValues, value);
  return new YearMonth(this, newValues);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

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

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

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

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

/**
 * Returns a copy of this year-month with the value of the specified field increased.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * <p>
 * These three lines are equivalent:
 * <pre>
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.monthOfYear().addToCopy(6);
 * </pre>
 * 
 * @param fieldType  the field type to add to, not null
 * @param amount  the amount to add
 * @return a copy of this instance with the field updated, never null
 * @throws IllegalArgumentException if the value is null or invalid
 * @throws ArithmeticException if the new date-time exceeds the capacity
 */
public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  int index = indexOfSupported(fieldType);
  if (amount == 0) {
    return this;
  }
  int[] newValues = getValues();
  newValues = getField(index).add(this, index, newValues, amount);
  return new YearMonth(this, newValues);
}

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

/**
 * Returns a copy of this year-month with the specified field set to a new value.
 * <p>
 * For example, if the field type is <code>monthOfYear</code> then the month
 * would be changed in the returned instance.
 * <p>
 * These three lines are equivalent:
 * <pre>
 * YearMonth updated = ym.withField(DateTimeFieldType.monthOfYear(), 6);
 * YearMonth updated = ym.monthOfYear().setCopy(6);
 * YearMonth updated = ym.property(DateTimeFieldType.monthOfYear()).setCopy(6);
 * </pre>
 *
 * @param fieldType  the field type to set, not null
 * @param value  the value to set
 * @return a copy of this instance with the field set, never null
 * @throws IllegalArgumentException if the value is null or invalid
 */
public YearMonth withField(DateTimeFieldType fieldType, int value) {
  int index = indexOfSupported(fieldType);
  if (value == getValue(index)) {
    return this;
  }
  int[] newValues = getValues();
  newValues = getField(index).set(this, index, newValues, value);
  return new YearMonth(this, newValues);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

/**
 * Gets the field that this property uses.
 * 
 * @return the field
 */
public DateTimeField getField() {
  return iBase.getField(iFieldIndex);
}

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

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

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

/**
 * Returns a copy of this year-month with the value of the specified field increased.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * <p>
 * These three lines are equivalent:
 * <pre>
 * YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);
 * YearMonth added = ym.plusMonths(6);
 * YearMonth added = ym.monthOfYear().addToCopy(6);
 * </pre>
 * 
 * @param fieldType  the field type to add to, not null
 * @param amount  the amount to add
 * @return a copy of this instance with the field updated, never null
 * @throws IllegalArgumentException if the value is null or invalid
 * @throws ArithmeticException if the new date-time exceeds the capacity
 */
public YearMonth withFieldAdded(DurationFieldType fieldType, int amount) {
  int index = indexOfSupported(fieldType);
  if (amount == 0) {
    return this;
  }
  int[] newValues = getValues();
  newValues = getField(index).add(this, index, newValues, amount);
  return new YearMonth(this, newValues);
}

相关文章