org.joda.time.format.DateTimeFormatter.requireParser()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(130)

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

DateTimeFormatter.requireParser介绍

[英]Checks whether parsing is supported.
[中]检查是否支持解析。

代码示例

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  the text to parse, not null
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  InternalParser parser = requireParser();
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
  return bucket.doParseMillis(parser, text);
}

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  the text to parse, not null
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  InternalParser parser = requireParser();
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
  return bucket.doParseMillis(parser, text);
}

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

InternalParser parser = requireParser();

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

InternalParser parser = requireParser();

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

InternalParser parser = requireParser();

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

InternalParser parser = requireParser();

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

InternalParser parser = requireParser();

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

InternalParser parser = requireParser();

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

InternalParser parser = requireParser();
if (instant == null) {
  throw new IllegalArgumentException("Instant must not be null");

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

InternalParser parser = requireParser();
if (instant == null) {
  throw new IllegalArgumentException("Instant must not be null");

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  text to parse
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  DateTimeParser parser = requireParser();
  
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
  int newPos = parser.parseInto(bucket, text, 0);
  if (newPos >= 0) {
    if (newPos >= text.length()) {
      return bucket.computeMillis(true, text);
    }
  } else {
    newPos = ~newPos;
  }
  throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos));
}

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

DateTimeParser parser = requireParser();

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

DateTimeParser parser = requireParser();

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

DateTimeParser parser = requireParser();

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

DateTimeParser parser = requireParser();
if (instant == null) {
  throw new IllegalArgumentException("Instant must not be null");

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  the text to parse, not null
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  InternalParser parser = requireParser();
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
  return bucket.doParseMillis(parser, text);
}

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  the text to parse, not null
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  InternalParser parser = requireParser();
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
  return bucket.doParseMillis(parser, text);
}

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  text to parse
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  DateTimeParser parser = requireParser();
  
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
  int newPos = parser.parseInto(bucket, text, 0);
  if (newPos >= 0) {
    if (newPos >= text.length()) {
      return bucket.computeMillis(true, text);
    }
  } else {
    newPos = ~newPos;
  }
  throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos));
}

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  text to parse
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  DateTimeParser parser = requireParser();
  
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
  int newPos = parser.parseInto(bucket, text, 0);
  if (newPos >= 0) {
    if (newPos >= text.length()) {
      return bucket.computeMillis(true, text);
    }
  } else {
    newPos = ~newPos;
  }
  throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos));
}

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

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  text to parse
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
public long parseMillis(String text) {
  DateTimeParser parser = requireParser();
  
  Chronology chrono = selectChronology(iChrono);
  DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear);
  int newPos = parser.parseInto(bucket, text, 0);
  if (newPos >= 0) {
    if (newPos >= text.length()) {
      return bucket.computeMillis(true, text);
    }
  } else {
    newPos = ~newPos;
  }
  throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos));
}

相关文章