-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CBL-1680: Phase 1, Add JSON API #24
Conversation
*/ | ||
public MutableArray(List<Object> data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this constructor??
Never mind it's up there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... I don't think the spec suggests removing this. It seems consistent with the constructors for Document and Dictionary objects.
*/ | ||
@NonNull | ||
@Override | ||
public MutableArray setJSON(@NonNull String json) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not ToJSON? Is this because you are following java naming convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setJSON() is in the MutableArray. toJSON() is inherited from (immutable) Array.
Is that how you did it?
* Map, Number, null, String, Array, Blob, and Dictionary. The List and Map must contain | ||
* only the above types. Setting the new array content will replace the current data | ||
* including the existing Array and Dictionary objects. | ||
* Populate an array with content from a Map. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confused! Map or List? Argument is List<Object>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... it is not totally clear. The idea is that the List can contains Maps or Lists. If it does, those Maps/Lists must contain only the types mentioned above. I've revisited the comments to try to make them clearer.
@@ -82,11 +86,26 @@ public MutableArray(List<Object> data) { | |||
public MutableArray setData(List<Object> data) { | |||
synchronized (lock) { | |||
internalArray.clear(); | |||
for (Object obj : data) { internalArray.append(Fleece.toCBLObject(obj)); } | |||
for (Object obj: data) { internalArray.append(Fleece.toCBLObject(obj)); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add @nonnull to data param as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Definitely
I believe this is the complete JSON API as spec'ed in https://docs.google.com/document/d/1H0mnutn-XXIADvGT_EjINAOVwt0Ea8vwW70v0i_PO54
There is no implementation here. This is just the API and fixed commenting.
Note that, although not specifically mentioned in the spec, I've updated the interfaces that define the Dictionary and Array APIs