当前位置: 首页>>代码示例>>Java>>正文


Java Timestamps.parse方法代码示例

本文整理汇总了Java中com.google.protobuf.util.Timestamps.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Timestamps.parse方法的具体用法?Java Timestamps.parse怎么用?Java Timestamps.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.protobuf.util.Timestamps的用法示例。


在下文中一共展示了Timestamps.parse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keep_multiple_filters_for_single_column

import com.google.protobuf.util.Timestamps; //导入方法依赖的package包/类
@Test
public void keep_multiple_filters_for_single_column() throws ParseException {
    final String columnName = "time";
    final EntityColumn column = mock(EntityColumn.class);

    // Some valid Timestamp values
    final Timestamp startTime = Timestamps.parse("2000-01-01T10:00:00.000-05:00");
    final Timestamp deadline = Timestamps.parse("2017-01-01T10:00:00.000-05:00");

    final ColumnFilter startTimeFilter = gt(columnName, startTime);
    final ColumnFilter deadlineFilter = le(columnName, deadline);
    final Multimap<EntityColumn, ColumnFilter> columnFilters =
            ImmutableMultimap.<EntityColumn, ColumnFilter>builder()
                             .put(column, startTimeFilter)
                             .put(column, deadlineFilter)
                             .build();
    final CompositeQueryParameter parameter = from(columnFilters, ALL);
    final QueryParameters parameters = newBuilder().add(parameter)
                                                   .build();
    final List<CompositeQueryParameter> aggregatingParameters = newArrayList(parameters);
    assertSize(1, aggregatingParameters);
    final Multimap<EntityColumn, ColumnFilter> actualColumnFilters = aggregatingParameters.get(0).getFilters();
    final Collection<ColumnFilter> timeFilters = actualColumnFilters.get(column);
    assertSize(2, timeFilters);
    assertContainsAll(timeFilters, startTimeFilter, deadlineFilter);
}
 
开发者ID:SpineEventEngine,项目名称:core-java,代码行数:27,代码来源:QueryParametersShould.java

示例2: merge

import com.google.protobuf.util.Timestamps; //导入方法依赖的package包/类
@Override
public void merge(JsonElement json, Builder builder) throws InvalidProtocolBufferException {
    try {
        Timestamp value = Timestamps.parse(json.getAsString());
        builder.mergeFrom(value.toByteString());
      } catch (ParseException e) {
        throw new InvalidProtocolBufferException("Failed to parse timestamp: " + json);
      }
}
 
开发者ID:SeldonIO,项目名称:seldon-core,代码行数:10,代码来源:TimeUtils.java

示例3: mergeTimestamp

import com.google.protobuf.util.Timestamps; //导入方法依赖的package包/类
private void mergeTimestamp(JsonElement json, Message.Builder builder)
    throws InvalidProtocolBufferException {
  try {
    Timestamp value = Timestamps.parse(json.getAsString());
    builder.mergeFrom(value.toByteString());
  } catch (ParseException e) {
    throw new InvalidProtocolBufferException("Failed to parse timestamp: " + json);
  }
}
 
开发者ID:SeldonIO,项目名称:seldon-core,代码行数:10,代码来源:JsonFormat.java


注:本文中的com.google.protobuf.util.Timestamps.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。