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

x33g5p2x  于2022-01-20 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(165)

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

Instant.parse介绍

[英]Parses a Instant from the specified string.

This uses ISODateTimeFormat#dateTimeParser().
[中]从指定的字符串中解析瞬间。
这将使用ISODateTimeFormat#dateTimeParser()。

代码示例

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

/**
 * Parses an {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

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

/**
 * Parses an {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

代码示例来源:origin: alibaba/fastjson

Instant instant = Instant.parse(text);

代码示例来源:origin: com.alibaba/fastjson

Instant instant = Instant.parse(text);

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-joda

@Override
  public Instant deserialize(JsonParser p, DeserializationContext ctxt) throws IOException
  {
    JsonToken t = p.getCurrentToken();
    if (t == JsonToken.VALUE_NUMBER_INT) {
      return new Instant(p.getLongValue());
    }
    if (t == JsonToken.VALUE_STRING) {
      String str = p.getText().trim();
      if (str.length() == 0) {
        return null;
      }
      // 11-Sep-2018, tatu: `DateTimeDeserializer` allows timezone inclusion in brackets;
      //    should that be checked here too?
      return Instant.parse(str, _format.createParser(ctxt));
    }
    return _handleNotNumberOrString(p, ctxt);
  }
}

代码示例来源:origin: org.n52.sensorweb/timeseries-io

private Instant validateTimestamp(String timestamp) {
  try {
    return Instant.parse(timestamp);
  } catch (Exception e) {
    String message = "Could not parse result time parameter." + timestamp;
    throw new IoParseException(message, e);
  }
}

代码示例来源:origin: powertac/powertac-server

private void updateTime (String time)
{
 Instant value = Instant.parse(time);
 timeService.setCurrentTime(value);
 log.debug("time set to " + time);
}

代码示例来源:origin: ome/ome-xml

public Timestamp(final String value) throws IllegalArgumentException, UnsupportedOperationException {
 this.timestamp = Instant.parse(value, ISO8601_PARSER);
 this.value = toString();
}

代码示例来源:origin: org.openmicroscopy/ome-xml

public Timestamp(final String value) throws IllegalArgumentException, UnsupportedOperationException {
 this.timestamp = Instant.parse(value, ISO8601_PARSER);
 this.value = toString();
}

代码示例来源:origin: takidau/streamingbook

@ProcessElement
public void processElement(@Element String input, OutputReceiver<KV<String, Integer>> output) {
  String[] parts = input.split(",");
  String team = parts[1].trim();
  Integer score = Integer.parseInt(parts[2].trim());
  Instant eventTime = Instant.parse(parts[3].trim());
  output.outputWithTimestamp(KV.of(team, score), eventTime);
}
}

代码示例来源:origin: zhicwu/cassandra-jdbc-driver

@Override
public ByteBuffer serialize(String value, ProtocolVersion protocolVersion) {
  if (value == null) {
    return null;
  }
  if (value.indexOf(' ') == 10 && value.indexOf('Z') < 0) {
    StringBuilder builder = new StringBuilder(value).append('Z');
    builder.setCharAt(10, 'T');
    value = builder.toString();
  }
  return bigint().serializeNoBoxing(Instant.parse(value).getMillis(), protocolVersion);
}

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

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

/**
 * Parses a {@code Instant} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#dateTimeParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static Instant parse(String str) {
  return parse(str, ISODateTimeFormat.dateTimeParser());
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform

private void truncatedRfc339(String timestamp, String truncatedTimestmap) {
 assertEquals(Instant.parse(truncatedTimestmap).getMillis(), parse(timestamp));
}

相关文章