16
16
17
17
package com .google .cloud .firestore ;
18
18
19
+ import com .google .api .core .BetaApi ;
19
20
import com .google .api .core .InternalExtensionOnly ;
20
21
import com .google .cloud .Timestamp ;
21
22
import com .google .common .base .Preconditions ;
43
44
* that does so.
44
45
*/
45
46
@ InternalExtensionOnly
47
+ @ BetaApi
46
48
public final class PipelineResult {
47
49
48
50
private final FirestoreRpcContext <?> rpcContext ;
@@ -73,6 +75,7 @@ public final class PipelineResult {
73
75
* @return The id of the document.
74
76
*/
75
77
@ Nonnull
78
+ @ BetaApi
76
79
public String getId () {
77
80
return docRef .getId ();
78
81
}
@@ -96,6 +99,7 @@ static PipelineResult fromDocument(
96
99
* @return The read time of this snapshot.
97
100
*/
98
101
@ Nullable
102
+ @ BetaApi
99
103
public Timestamp getReadTime () {
100
104
return readTime ;
101
105
}
@@ -108,6 +112,7 @@ public Timestamp getReadTime() {
108
112
* exist.
109
113
*/
110
114
@ Nullable
115
+ @ BetaApi
111
116
public Timestamp getUpdateTime () {
112
117
return updateTime ;
113
118
}
@@ -119,6 +124,7 @@ public Timestamp getUpdateTime() {
119
124
* exist.
120
125
*/
121
126
@ Nullable
127
+ @ BetaApi
122
128
public Timestamp getCreateTime () {
123
129
return createTime ;
124
130
}
@@ -129,6 +135,7 @@ public Timestamp getCreateTime() {
129
135
*
130
136
* @return whether the document existed in this snapshot.
131
137
*/
138
+ @ BetaApi
132
139
public boolean exists () {
133
140
return fields != null ;
134
141
}
@@ -140,6 +147,7 @@ public boolean exists() {
140
147
* @return The fields of the document as a Map or null if the document doesn't exist.
141
148
*/
142
149
@ Nullable
150
+ @ BetaApi
143
151
public Map <String , Object > getData () {
144
152
if (fields == null ) {
145
153
return null ;
@@ -161,6 +169,7 @@ public Map<String, Object> getData() {
161
169
* exist.
162
170
*/
163
171
@ Nullable
172
+ @ BetaApi
164
173
public <T > T toObject (@ Nonnull Class <T > valueType ) {
165
174
Map <String , Object > data = getData ();
166
175
return data == null ? null : CustomClassMapper .convertToCustomClass (data , valueType , docRef );
@@ -173,6 +182,7 @@ public <T> T toObject(@Nonnull Class<T> valueType) {
173
182
* @param field the path to the field.
174
183
* @return true iff the field exists.
175
184
*/
185
+ @ BetaApi
176
186
public boolean contains (@ Nonnull String field ) {
177
187
return contains (FieldPath .fromDotSeparatedString (field ));
178
188
}
@@ -184,6 +194,7 @@ public boolean contains(@Nonnull String field) {
184
194
* @param fieldPath the path to the field.
185
195
* @return true iff the field exists.
186
196
*/
197
+ @ BetaApi
187
198
public boolean contains (@ Nonnull FieldPath fieldPath ) {
188
199
return this .extractField (fieldPath ) != null ;
189
200
}
@@ -195,6 +206,7 @@ public boolean contains(@Nonnull FieldPath fieldPath) {
195
206
* @return The value at the given field or null.
196
207
*/
197
208
@ Nullable
209
+ @ BetaApi
198
210
public Object get (@ Nonnull String field ) {
199
211
return get (FieldPath .fromDotSeparatedString (field ));
200
212
}
@@ -208,6 +220,7 @@ public Object get(@Nonnull String field) {
208
220
* @return The value at the given field or null.
209
221
*/
210
222
@ Nullable
223
+ @ BetaApi
211
224
public <T > T get (@ Nonnull String field , @ Nonnull Class <T > valueType ) {
212
225
return get (FieldPath .fromDotSeparatedString (field ), valueType );
213
226
}
@@ -219,6 +232,7 @@ public <T> T get(@Nonnull String field, @Nonnull Class<T> valueType) {
219
232
* @return The value at the given field or null.
220
233
*/
221
234
@ Nullable
235
+ @ BetaApi
222
236
public Object get (@ Nonnull FieldPath fieldPath ) {
223
237
Value value = extractField (fieldPath );
224
238
@@ -238,6 +252,7 @@ public Object get(@Nonnull FieldPath fieldPath) {
238
252
* @return The value at the given field or null.
239
253
*/
240
254
@ Nullable
255
+ @ BetaApi
241
256
public <T > T get (@ Nonnull FieldPath fieldPath , Class <T > valueType ) {
242
257
Object data = get (fieldPath );
243
258
return data == null ? null : CustomClassMapper .convertToCustomClass (data , valueType , docRef );
@@ -271,6 +286,7 @@ Value extractField(@Nonnull FieldPath fieldPath) {
271
286
* @return The value of the field.
272
287
*/
273
288
@ Nullable
289
+ @ BetaApi
274
290
public Boolean getBoolean (@ Nonnull String field ) {
275
291
return (Boolean ) get (field );
276
292
}
@@ -283,6 +299,7 @@ public Boolean getBoolean(@Nonnull String field) {
283
299
* @return The value of the field.
284
300
*/
285
301
@ Nullable
302
+ @ BetaApi
286
303
public Double getDouble (@ Nonnull String field ) {
287
304
Number number = (Number ) get (field );
288
305
return number == null ? null : number .doubleValue ();
@@ -296,6 +313,7 @@ public Double getDouble(@Nonnull String field) {
296
313
* @return The value of the field.
297
314
*/
298
315
@ Nullable
316
+ @ BetaApi
299
317
public String getString (@ Nonnull String field ) {
300
318
return (String ) get (field );
301
319
}
@@ -308,6 +326,7 @@ public String getString(@Nonnull String field) {
308
326
* @return The value of the field.
309
327
*/
310
328
@ Nullable
329
+ @ BetaApi
311
330
public Long getLong (@ Nonnull String field ) {
312
331
Number number = (Number ) get (field );
313
332
return number == null ? null : number .longValue ();
@@ -321,6 +340,7 @@ public Long getLong(@Nonnull String field) {
321
340
* @return The value of the field.
322
341
*/
323
342
@ Nullable
343
+ @ BetaApi
324
344
public Date getDate (@ Nonnull String field ) {
325
345
Timestamp timestamp = getTimestamp (field );
326
346
return timestamp == null ? null : timestamp .toDate ();
@@ -334,6 +354,7 @@ public Date getDate(@Nonnull String field) {
334
354
* @return The value of the field.
335
355
*/
336
356
@ Nullable
357
+ @ BetaApi
337
358
public Timestamp getTimestamp (@ Nonnull String field ) {
338
359
return (Timestamp ) get (field );
339
360
}
@@ -346,6 +367,7 @@ public Timestamp getTimestamp(@Nonnull String field) {
346
367
* @return The value of the field.
347
368
*/
348
369
@ Nullable
370
+ @ BetaApi
349
371
public Blob getBlob (@ Nonnull String field ) {
350
372
return (Blob ) get (field );
351
373
}
@@ -358,6 +380,7 @@ public Blob getBlob(@Nonnull String field) {
358
380
* @return The value of the field.
359
381
*/
360
382
@ Nullable
383
+ @ BetaApi
361
384
public GeoPoint getGeoPoint (@ Nonnull String field ) {
362
385
return (GeoPoint ) get (field );
363
386
}
@@ -368,6 +391,7 @@ public GeoPoint getGeoPoint(@Nonnull String field) {
368
391
* @return The reference to the document.
369
392
*/
370
393
@ Nonnull
394
+ @ BetaApi
371
395
public DocumentReference getReference () {
372
396
return docRef ;
373
397
}
@@ -408,6 +432,7 @@ Document.Builder toDocumentPb() {
408
432
* @return Whether this DocumentSnapshot is equal to the provided object.
409
433
*/
410
434
@ Override
435
+ @ BetaApi
411
436
public boolean equals (Object obj ) {
412
437
if (this == obj ) {
413
438
return true ;
0 commit comments