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

x33g5p2x  于2022-01-23 转载在 其他  
字(12.5k)|赞(0)|评价(0)|浏览(139)

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

LocalTime.isSupported介绍

[英]Checks if the field type specified is supported by this local time and chronology. This can be used to avoid exceptions in #get(DateTimeFieldType).
[中]检查此本地时间和年表是否支持指定的字段类型。这可以用来避免#get(DateTimeFieldType)中的异常。

代码示例

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

/**
 * Checks if the field type specified is supported by this
 * local time and chronology.
 * This can be used to avoid exceptions in {@link #get(DateTimeFieldType)}.
 *
 * @param type  a field type, usually obtained from DateTimeFieldType
 * @return true if the field type is supported
 */
public boolean isSupported(DateTimeFieldType type) {
  if (type == null) {
    return false;
  }
  if (isSupported(type.getDurationType()) == false) {
    return false;
  }
  DurationFieldType range = type.getRangeDurationType();
  return (isSupported(range) || range == DurationFieldType.days());
}

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

/**
 * Checks if the field type specified is supported by this
 * local time and chronology.
 * This can be used to avoid exceptions in {@link #get(DateTimeFieldType)}.
 *
 * @param type  a field type, usually obtained from DateTimeFieldType
 * @return true if the field type is supported
 */
public boolean isSupported(DateTimeFieldType type) {
  if (type == null) {
    return false;
  }
  if (isSupported(type.getDurationType()) == false) {
    return false;
  }
  DurationFieldType range = type.getRangeDurationType();
  return (isSupported(range) || range == DurationFieldType.days());
}

代码示例来源: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 time.
 * <p>
 * This method gets the value of the specified field.
 * For example:
 * <pre>
 * DateTime dt = new DateTime();
 * int hourOfDay = dt.get(DateTimeFieldType.hourOfDay());
 * </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
 */
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 time.
 * <p>
 * This method gets the value of the specified field.
 * For example:
 * <pre>
 * DateTime dt = new DateTime();
 * int hourOfDay = dt.get(DateTimeFieldType.hourOfDay());
 * </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
 */
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 time with the specified field set
 * to a new value.
 * <p>
 * For example, if the field type is <code>hourOfDay</code> then the hour of day
 * field would be changed in the returned instance.
 * If the field type is null, then <code>this</code> is returned.
 * <p>
 * These lines are equivalent:
 * <pre>
 * LocalTime updated = dt.withHourOfDay(6);
 * LocalTime updated = dt.withField(DateTimeFieldType.hourOfDay(), 6);
 * </pre>
 *
 * @param fieldType  the field type to set, not null
 * @param value  the value to set
 * @return a copy of this time with the field set
 * @throws IllegalArgumentException if the value is null or invalid
 */
public LocalTime 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 time with the specified field set
 * to a new value.
 * <p>
 * For example, if the field type is <code>hourOfDay</code> then the hour of day
 * field would be changed in the returned instance.
 * If the field type is null, then <code>this</code> is returned.
 * <p>
 * These lines are equivalent:
 * <pre>
 * LocalTime updated = dt.withHourOfDay(6);
 * LocalTime updated = dt.withField(DateTimeFieldType.hourOfDay(), 6);
 * </pre>
 *
 * @param fieldType  the field type to set, not null
 * @param value  the value to set
 * @return a copy of this time with the field set
 * @throws IllegalArgumentException if the value is null or invalid
 */
public LocalTime 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: camunda/camunda-bpm-platform

/**
 * Checks if the field type specified is supported by this
 * local time and chronology.
 * This can be used to avoid exceptions in {@link #get(DateTimeFieldType)}.
 *
 * @param type  a field type, usually obtained from DateTimeFieldType
 * @return true if the field type is supported
 */
public boolean isSupported(DateTimeFieldType type) {
  if (type == null) {
    return false;
  }
  if (isSupported(type.getDurationType()) == false) {
    return false;
  }
  DurationFieldType range = type.getRangeDurationType();
  return (isSupported(range) || range == DurationFieldType.days());
}

代码示例来源: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 time.
 * <p>
 * This method gets the value of the specified field.
 * For example:
 * <pre>
 * DateTime dt = new DateTime();
 * int hourOfDay = dt.get(DateTimeFieldType.hourOfDay());
 * </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
 */
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 time with the specified field set
 * to a new value.
 * <p>
 * For example, if the field type is <code>hourOfDay</code> then the hour of day
 * field would be changed in the returned instance.
 * If the field type is null, then <code>this</code> is returned.
 * <p>
 * These lines are equivalent:
 * <pre>
 * LocalTime updated = dt.withHourOfDay(6);
 * LocalTime updated = dt.withField(DateTimeFieldType.hourOfDay(), 6);
 * </pre>
 *
 * @param fieldType  the field type to set, not null
 * @param value  the value to set
 * @return a copy of this time with the field set
 * @throws IllegalArgumentException if the value is null or invalid
 */
public LocalTime 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: Nextdoor/bender

/**
 * Checks if the field type specified is supported by this
 * local time and chronology.
 * This can be used to avoid exceptions in {@link #get(DateTimeFieldType)}.
 *
 * @param type  a field type, usually obtained from DateTimeFieldType
 * @return true if the field type is supported
 */
public boolean isSupported(DateTimeFieldType type) {
  if (type == null) {
    return false;
  }
  if (isSupported(type.getDurationType()) == false) {
    return false;
  }
  DurationFieldType range = type.getRangeDurationType();
  return (isSupported(range) || range == DurationFieldType.days());
}

代码示例来源:origin: org.joda/com.springsource.org.joda.time

/**
 * Checks if the field type specified is supported by this
 * local time and chronology.
 * This can be used to avoid exceptions in {@link #get(DateTimeFieldType)}.
 *
 * @param type  a field type, usually obtained from DateTimeFieldType
 * @return true if the field type is supported
 */
public boolean isSupported(DateTimeFieldType type) {
  if (type == null) {
    return false;
  }
  if (isSupported(type.getDurationType()) == false) {
    return false;
  }
  DurationFieldType range = type.getRangeDurationType();
  return (isSupported(range) || range == DurationFieldType.days());
}

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

/**
 * Checks if the field type specified is supported by this
 * local time and chronology.
 * This can be used to avoid exceptions in {@link #get(DateTimeFieldType)}.
 *
 * @param type  a field type, usually obtained from DateTimeFieldType
 * @return true if the field type is supported
 */
public boolean isSupported(DateTimeFieldType type) {
  if (type == null) {
    return false;
  }
  if (isSupported(type.getDurationType()) == false) {
    return false;
  }
  DurationFieldType range = type.getRangeDurationType();
  return (isSupported(range) || range == DurationFieldType.days());
}

代码示例来源: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: org.kill-bill.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()));
}

相关文章