Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
addressing more nits.
  • Loading branch information
wu-hui committed May 23, 2019
commit 2d5ec684307c2d5533e96c1544d869c0d36edf5c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public UserDataConverter(DatabaseId databaseId) {
/**
* Parse document data from a non-merge set() call.
*
* @param input A POJO object representing document data.
* @param input A map or POJO object representing document data.
*/
public ParsedSetData parseSetData(Object input) {
ParseAccumulator accumulator = new ParseAccumulator(UserData.Source.Set);
Expand All @@ -87,7 +87,7 @@ public ParsedSetData parseSetData(Object input) {
/**
* Parse document data from a set() call with SetOptions.merge() set.
*
* @param input A POJO object representing document data.
* @param input A map or POJO object representing document data.
* @param fieldMask A {@link FieldMask} object representing the fields to be merged.
*/
public ParsedSetData parseMergeData(Object input, @Nullable FieldMask fieldMask) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static Map<String, Object> convertToPlainJavaTypes(Map<?, Object> update)
*/
public static <T> T convertToCustomClass(
Object object, Class<T> clazz, DocumentReference docRef) {
// TODO: Use DeserializeContext to encapsulate ErrorPath and docRef.
// TODO(wuandy): Use DeserializeContext to encapsulate ErrorPath and docRef.
return deserializeToClass(object, clazz, ErrorPath.EMPTY);
}

Expand Down Expand Up @@ -757,7 +757,7 @@ private Type resolveType(Type type, Map<TypeVariable<Class<T>>, Type> types) {
}

Map<String, Object> serialize(T object, ErrorPath path) {
// TODO: Add logic to skip @DocumentId annotated fields in serialization.
// TODO(wuandy): Add logic to skip @DocumentId annotated fields in serialization.
if (!clazz.isAssignableFrom(object.getClass())) {
throw new IllegalArgumentException(
"Can't serialize object of class "
Expand Down Expand Up @@ -1015,18 +1015,4 @@ public String toString() {
}
}
}

static class DeserializeContext {
final ErrorPath errorPath;
final String documentId;

DeserializeContext(ErrorPath path, String docId) {
errorPath = path;
documentId = docId;
}

DeserializeContext newInstanceWithErrorPath(ErrorPath newPath) {
return new DeserializeContext(newPath, documentId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
@PublicApi
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface DocumentId {}
@interface DocumentId {}