本文整理了Java中org.joda.time.LocalDate.isSupported()
方法的一些代码示例,展示了LocalDate.isSupported()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.isSupported()
方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:isSupported
[英]Checks if the field type specified is supported by this local date and chronology. This can be used to avoid exceptions in #get(DateTimeFieldType).
[中]检查此本地日期和时间顺序是否支持指定的字段类型。这可以用来避免#get(DateTimeFieldType)中的异常。
代码示例来源:origin: joda-time/joda-time
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
代码示例来源:origin: joda-time/joda-time
/**
* Get the value of one of the fields of a datetime.
* <p>
* This method gets the value of the specified field.
* For example:
* <pre>
* LocalDate dt = LocalDate.nowDefaultZone();
* int year = dt.get(DateTimeFieldType.year());
* </pre>
*
* @param fieldType a field type, usually obtained from DateTimeFieldType, not null
* @return the value of that field
* @throws IllegalArgumentException if the field type is null or unsupported
*/
public int get(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return fieldType.getField(getChronology()).get(getLocalMillis());
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Get the value of one of the fields of a datetime.
* <p>
* This method gets the value of the specified field.
* For example:
* <pre>
* LocalDate dt = LocalDate.nowDefaultZone();
* int year = dt.get(DateTimeFieldType.year());
* </pre>
*
* @param fieldType a field type, usually obtained from DateTimeFieldType, not null
* @return the value of that field
* @throws IllegalArgumentException if the field type is null or unsupported
*/
public int get(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return fieldType.getField(getChronology()).get(getLocalMillis());
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date with the specified field set to a new value.
* <p>
* For example, if the field type is <code>monthOfYear</code> then the
* month of year field will be changed in the returned instance.
* If the field type is null, then <code>this</code> is returned.
* <p>
* These two lines are equivalent:
* <pre>
* LocalDate updated = dt.withDayOfMonth(6);
* LocalDate updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
* </pre>
*
* @param fieldType the field type to set, not null
* @param value the value to set
* @return a copy of this date with the field set
* @throws IllegalArgumentException if the field is null or unsupported
*/
public LocalDate withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
}
代码示例来源:origin: joda-time/joda-time
throw new IllegalArgumentException("Field must not be null");
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this date with the specified field set to a new value.
* <p>
* For example, if the field type is <code>monthOfYear</code> then the
* month of year field will be changed in the returned instance.
* If the field type is null, then <code>this</code> is returned.
* <p>
* These two lines are equivalent:
* <pre>
* LocalDate updated = dt.withDayOfMonth(6);
* LocalDate updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
* </pre>
*
* @param fieldType the field type to set, not null
* @param value the value to set
* @return a copy of this date with the field set
* @throws IllegalArgumentException if the field is null or unsupported
*/
public LocalDate withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
}
代码示例来源:origin: JodaOrg/joda-time
throw new IllegalArgumentException("Field must not be null");
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
代码示例来源:origin: joda-time/joda-time
long value = FieldUtils.safeMultiply(period.getValue(i), scalar);
DurationFieldType type = period.getFieldType(i);
if (isSupported(type)) {
instant = type.getField(chrono).add(instant, value);
代码示例来源:origin: JodaOrg/joda-time
long value = FieldUtils.safeMultiply(period.getValue(i), scalar);
DurationFieldType type = period.getFieldType(i);
if (isSupported(type)) {
instant = type.getField(chrono).add(instant, value);
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Get the value of one of the fields of a datetime.
* <p>
* This method gets the value of the specified field.
* For example:
* <pre>
* LocalDate dt = LocalDate.nowDefaultZone();
* int year = dt.get(DateTimeFieldType.year());
* </pre>
*
* @param fieldType a field type, usually obtained from DateTimeFieldType, not null
* @return the value of that field
* @throws IllegalArgumentException if the field type is null or unsupported
*/
public int get(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return fieldType.getField(getChronology()).get(getLocalMillis());
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this date with the specified field set to a new value.
* <p>
* For example, if the field type is <code>monthOfYear</code> then the
* month of year field will be changed in the returned instance.
* If the field type is null, then <code>this</code> is returned.
* <p>
* These two lines are equivalent:
* <pre>
* LocalDate updated = dt.withDayOfMonth(6);
* LocalDate updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
* </pre>
*
* @param fieldType the field type to set, not null
* @param value the value to set
* @return a copy of this date with the field set
* @throws IllegalArgumentException if the field is null or unsupported
*/
public LocalDate withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
}
代码示例来源:origin: camunda/camunda-bpm-platform
throw new IllegalArgumentException("Field must not be null");
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
代码示例来源:origin: camunda/camunda-bpm-platform
long value = FieldUtils.safeMultiply(period.getValue(i), scalar);
DurationFieldType type = period.getFieldType(i);
if (isSupported(type)) {
instant = type.getField(chrono).add(instant, value);
代码示例来源:origin: Nextdoor/bender
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
代码示例来源:origin: org.joda/com.springsource.org.joda.time
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Gets the property object for the specified type, which contains many
* useful methods.
*
* @param fieldType the field type to get the chronology for
* @return the property object
* @throws IllegalArgumentException if the field is null or unsupported
*/
public Property property(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
return new Property(this, fieldType.getField(getChronology()));
}
内容来源于网络,如有侵权,请联系作者删除!