本文整理了Java中org.joda.time.Partial.getField()
方法的一些代码示例,展示了Partial.getField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partial.getField()
方法的具体详情如下:
包路径:org.joda.time.Partial
类名称:Partial
方法名:getField
[英]Gets the field for a specific index in the chronology specified.
[中]获取指定年表中特定索引的字段。
代码示例来源:origin: joda-time/joda-time
/**
* Gets the field that this property uses.
*
* @return the field
*/
public DateTimeField getField() {
return iPartial.getField(iFieldIndex);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets the field that this property uses.
*
* @return the field
*/
public DateTimeField getField() {
return iPartial.getField(iFieldIndex);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* However, it will not wrap around if the top maximum is reached.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial 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 Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* If the maximum is reached, the addition will wrap.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).addWrapPartial(this, index, newValues, amount);
return new Partial(this, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* However, it will not wrap around if the top maximum is reached.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial 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 Partial(this, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* If the maximum is reached, the addition will wrap.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).addWrapPartial(this, index, newValues, amount);
return new Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the specified field set to a new value.
* <p>
* If this partial does not support the field, an exception is thrown.
* Contrast this behaviour with {@link #with(DateTimeFieldType, int)}.
* <p>
* For example, if the field type is <code>dayOfMonth</code> then the day
* would be changed in the returned instance if supported.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
*/
public Partial 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 Partial(this, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the specified field set to a new value.
* <p>
* If this partial does not support the field, an exception is thrown.
* Contrast this behaviour with {@link #with(DateTimeFieldType, int)}.
* <p>
* For example, if the field type is <code>dayOfMonth</code> then the day
* would be changed in the returned instance if supported.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
*/
public Partial 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 Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the specified period added.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* Fields in the period that aren't present in the partial are ignored.
* <p>
* This method is typically used to add multiple copies of complex
* period instances. Adding one field is best achieved using the method
* {@link #withFieldAdded(DurationFieldType, int)}.
*
* @param period the period to add to this one, null means zero
* @param scalar the amount of times to add, such as -1 to subtract once
* @return a copy of this instance with the period added
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withPeriodAdded(ReadablePeriod period, int scalar) {
if (period == null || scalar == 0) {
return this;
}
int[] newValues = getValues();
for (int i = 0; i < period.size(); i++) {
DurationFieldType fieldType = period.getFieldType(i);
int index = indexOf(fieldType);
if (index >= 0) {
newValues = getField(index).add(this, index, newValues,
FieldUtils.safeMultiply(period.getValue(i), scalar));
}
}
return new Partial(this, newValues);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Gets the field that this property uses.
*
* @return the field
*/
public DateTimeField getField() {
return iPartial.getField(iFieldIndex);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the specified period added.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* Fields in the period that aren't present in the partial are ignored.
* <p>
* This method is typically used to add multiple copies of complex
* period instances. Adding one field is best achieved using the method
* {@link #withFieldAdded(DurationFieldType, int)}.
*
* @param period the period to add to this one, null means zero
* @param scalar the amount of times to add, such as -1 to subtract once
* @return a copy of this instance with the period added
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withPeriodAdded(ReadablePeriod period, int scalar) {
if (period == null || scalar == 0) {
return this;
}
int[] newValues = getValues();
for (int i = 0; i < period.size(); i++) {
DurationFieldType fieldType = period.getFieldType(i);
int index = indexOf(fieldType);
if (index >= 0) {
newValues = getField(index).add(this, index, newValues,
FieldUtils.safeMultiply(period.getValue(i), scalar));
}
}
return new Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
newValues = getField(index).set(this, index, newValues, value);
return new Partial(this, newValues);
代码示例来源:origin: JodaOrg/joda-time
newValues = getField(index).set(this, index, newValues, value);
return new Partial(this, newValues);
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* However, it will not wrap around if the top maximum is reached.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial 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 Partial(this, newValues);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* If the maximum is reached, the addition will wra.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).addWrapPartial(this, index, newValues, amount);
return new Partial(this, newValues);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Gets a copy of this Partial with the specified field set to a new value.
* <p>
* If this partial does not support the field, an exception is thrown.
* Contrast this behaviour with {@link #with(DateTimeFieldType, int)}.
* <p>
* For example, if the field type is <code>dayOfMonth</code> then the day
* would be changed in the returned instance if supported.
*
* @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
* @throws IllegalArgumentException if the value is null or invalid
*/
public Partial 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 Partial(this, newValues);
}
代码示例来源: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 iPartial.getField(iFieldIndex);
}
代码示例来源:origin: org.joda/com.springsource.org.joda.time
/**
* Gets the field that this property uses.
*
* @return the field
*/
public DateTimeField getField() {
return iPartial.getField(iFieldIndex);
}
代码示例来源:origin: camunda/camunda-bpm-platform
newValues = getField(index).set(this, index, newValues, value);
return new Partial(this, newValues);
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Gets a copy of this Partial with the specified period added.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* Fields in the period that aren't present in the partial are ignored.
* <p>
* This method is typically used to add multiple copies of complex
* period instances. Adding one field is best achieved using the method
* {@link #withFieldAdded(DurationFieldType, int)}.
*
* @param period the period to add to this one, null means zero
* @param scalar the amount of times to add, such as -1 to subtract once
* @return a copy of this instance with the period added
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withPeriodAdded(ReadablePeriod period, int scalar) {
if (period == null || scalar == 0) {
return this;
}
int[] newValues = getValues();
for (int i = 0; i < period.size(); i++) {
DurationFieldType fieldType = period.getFieldType(i);
int index = indexOf(fieldType);
if (index >= 0) {
newValues = getField(index).add(this, index, newValues,
FieldUtils.safeMultiply(period.getValue(i), scalar));
}
}
return new Partial(this, newValues);
}
内容来源于网络,如有侵权,请联系作者删除!