本文整理汇总了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);
}
示例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);
}
}
示例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);
}
}