@Override protected Timestamp getValue(com.google.datastore.v1.Value from) { return Timestamp.fromProto(from.getTimestampValue()); }
case 10: hash = (37 * hash) + TIMESTAMP_VALUE_FIELD_NUMBER; hash = (53 * hash) + getTimestampValue().hashCode(); break; case 5:
break; case 10: result = result && getTimestampValue().equals(other.getTimestampValue()); break; case 5:
mergeTimestampValue(other.getTimestampValue()); break;
@Override protected Timestamp getValue(com.google.datastore.v1.Value from) { return Timestamp.fromProto(from.getTimestampValue()); }
/** * Return the value as a date. * * @return the value. * @throws IllegalArgumentException if {@code Value} is not a date. */ public Date getDate() { if (!isDate()) { throw new IllegalArgumentException("Value does not contain a timestamp."); } return toDate(value.getTimestampValue()); }
/** * @return the timestamp in microseconds contained in value * @throws IllegalArgumentException if the value does not contain a timestamp. */ public static long getTimestamp(Value value) { if (value.getMeaning() == 18 && value.getValueTypeCase() == ValueTypeCase.INTEGER_VALUE) { return value.getIntegerValue(); } else if (value.getValueTypeCase() == ValueTypeCase.TIMESTAMP_VALUE) { return toMicroseconds(value.getTimestampValue()); } throw new IllegalArgumentException("Value does not contain a timestamp."); }
/** * @return the timestamp in microseconds contained in value * @throws IllegalArgumentException if the value does not contain a timestamp. */ public static long getTimestamp(Value value) { if (value.getMeaning() == 18 && value.getValueTypeCase() == ValueTypeCase.INTEGER_VALUE) { return value.getIntegerValue(); } else if (value.getValueTypeCase() == ValueTypeCase.TIMESTAMP_VALUE) { return toMicroseconds(value.getTimestampValue()); } throw new IllegalArgumentException("Value does not contain a timestamp."); }
case 10: hash = (37 * hash) + TIMESTAMP_VALUE_FIELD_NUMBER; hash = (53 * hash) + getTimestampValue().hashCode(); break; case 5:
case 10: hash = (37 * hash) + TIMESTAMP_VALUE_FIELD_NUMBER; hash = (53 * hash) + getTimestampValue().hashCode(); break; case 5:
/** * Cloud Datastore system tables with statistics are periodically updated. This method fetches * the latest timestamp (in microseconds) of statistics update using the {@code __Stat_Total__} * table. */ private static long queryLatestStatisticsTimestamp( Datastore datastore, @Nullable String namespace) throws DatastoreException { Query.Builder query = Query.newBuilder(); // Note: namespace either being null or empty represents the default namespace, in which // case we treat it as not provided by the user. if (Strings.isNullOrEmpty(namespace)) { query.addKindBuilder().setName("__Stat_Total__"); } else { query.addKindBuilder().setName("__Stat_Ns_Total__"); } query.addOrder(makeOrder("timestamp", DESCENDING)); query.setLimit(Int32Value.newBuilder().setValue(1)); RunQueryRequest request = makeRequest(query.build(), namespace); RunQueryResponse response = datastore.runQuery(request); QueryResultBatch batch = response.getBatch(); if (batch.getEntityResultsCount() == 0) { throw new NoSuchElementException("Datastore total statistics unavailable"); } Entity entity = batch.getEntityResults(0).getEntity(); return entity.getProperties().get("timestamp").getTimestampValue().getSeconds() * 1000000; }
break; case 10: result = result && getTimestampValue().equals(other.getTimestampValue()); break; case 5:
break; case 10: result = result && getTimestampValue() .equals(other.getTimestampValue()); break; case 5:
mergeTimestampValue(other.getTimestampValue()); break;
mergeTimestampValue(other.getTimestampValue()); break;