Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 24fb6fe

Browse files
author
Hideki Itakura
authored
Fixed #1475 - 2.0 API update (#1476)
Document.set(), Dictionary.setDictionary(), Array.setArray -> setData
1 parent a14b4e4 commit 24fb6fe

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

android/CouchbaseLite/src/androidTest/java/com/couchbase/lite/ArrayTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void testSetArrayList() throws CouchbaseLiteException {
153153
data.add("2");
154154
data.add("3");
155155
MutableArray array = new MutableArray();
156-
array.set(data);
156+
array.setData(data);
157157
assertEquals(3, array.count());
158158
assertEquals(data, array.toList());
159159

@@ -171,7 +171,7 @@ public void testSetArrayList() throws CouchbaseLiteException {
171171
data.add("4");
172172
data.add("5");
173173
data.add("6");
174-
array.set(data);
174+
array.setData(data);
175175

176176
assertEquals(data.size(), array.count());
177177
assertEquals(data, array.toList());

android/CouchbaseLite/src/androidTest/java/com/couchbase/lite/BaseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected void loadJSONResource(String name) throws Exception {
148148
Map<String, Object> props = JsonUtils.fromJson(json);
149149
String docId = String.format(Locale.ENGLISH, "doc-%03d", n);
150150
MutableDocument doc = createDocument(docId);
151-
doc.set(props);
151+
doc.setData(props);
152152
save(doc);
153153
}
154154
}

android/CouchbaseLite/src/androidTest/java/com/couchbase/lite/DocumentTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public void testSetDictionaryContent() throws CouchbaseLiteException {
256256
dict.put("phones", Arrays.asList("650-123-0001", "650-123-0002"));
257257

258258
MutableDocument doc = createDocument("doc1");
259-
doc.set(dict);
259+
doc.setData(dict);
260260
assertEquals(dict, doc.toMap());
261261

262262
Document savedDoc = save(doc);
@@ -276,7 +276,7 @@ public void testSetDictionaryContent() throws CouchbaseLiteException {
276276
nuDict.put("phones", Arrays.asList("650-234-0001", "650-234-0002"));
277277

278278
doc = savedDoc.toMutable();
279-
doc.set(nuDict);
279+
doc.setData(nuDict);
280280
assertEquals(nuDict, doc.toMap());
281281

282282
savedDoc = save(doc);
@@ -1632,7 +1632,7 @@ public void testRemoveKeys() throws CouchbaseLiteException {
16321632
profile.put("active", true);
16331633
profile.put("age", 30);
16341634
profile.put("address", mapAddress);
1635-
doc.set(profile);
1635+
doc.setData(profile);
16361636

16371637
save(doc);
16381638

@@ -1681,7 +1681,7 @@ public void testContainsKey() {
16811681
profile.put("name", "Jason");
16821682
profile.put("age", 30);
16831683
profile.put("address", mapAddress);
1684-
doc.set(profile);
1684+
doc.setData(profile);
16851685

16861686
assertTrue(doc.contains("type"));
16871687
assertTrue(doc.contains("name"));

shared/src/main/java/com/couchbase/lite/MutableArray.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public MutableArray() {
2727
* Map, Number, null, String, Array, Blob, and Dictionary. The List and Map must contain
2828
* only the above types.
2929
*
30-
* @param array the array object.
30+
* @param data the array object.
3131
*/
32-
public MutableArray(List<Object> array) {
32+
public MutableArray(List<Object> data) {
3333
super();
34-
set(array);
34+
setData(data);
3535
}
3636

3737
// to create copy
@@ -54,13 +54,13 @@ public MutableArray(List<Object> array) {
5454
* only the above types. Setting the new array content will replcace the current data
5555
* including the existing Array and Dictionary objects.
5656
*
57-
* @param array the array
57+
* @param data the array
5858
* @return this Array instance
5959
*/
6060
@Override
61-
public MutableArray set(List<Object> array) {
61+
public MutableArray setData(List<Object> data) {
6262
_array.clear();
63-
for (Object obj : array)
63+
for (Object obj : data)
6464
_array.append(CBLFleece.toCBLObject(obj));
6565
return this;
6666
}

shared/src/main/java/com/couchbase/lite/MutableArrayInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.List;
55

66
interface MutableArrayInterface extends ArrayInterface {
7-
MutableArrayInterface set(List<Object> list);
7+
MutableArrayInterface setData(List<Object> data);
88

99
// set
1010
MutableArrayInterface setValue(int index, Object value);

shared/src/main/java/com/couchbase/lite/MutableDictionary.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public MutableDictionary() {
2727
* Date, Map, Number, null, String, Array, Blob, and Dictionary. The List and Map must contain
2828
* only the above types.
2929
*
30-
* @param dictionary the dictionary object.
30+
* @param data the dictionary object.
3131
*/
32-
public MutableDictionary(Map<String, Object> dictionary) {
32+
public MutableDictionary(Map<String, Object> data) {
3333
super();
34-
set(dictionary);
34+
setData(data);
3535
}
3636

3737
// to create copy of dictionary
@@ -53,13 +53,13 @@ public MutableDictionary(Map<String, Object> dictionary) {
5353
* Setting the new dictionary content will replace the current data including the existing Array
5454
* and Dictionary objects.
5555
*
56-
* @param dictionary the dictionary object.
56+
* @param data the dictionary object.
5757
* @return this Dictionary instance
5858
*/
5959
@Override
60-
public MutableDictionary set(Map<String, Object> dictionary) {
60+
public MutableDictionary setData(Map<String, Object> data) {
6161
_dict.clear();
62-
for (Map.Entry<String, Object> entry : dictionary.entrySet())
62+
for (Map.Entry<String, Object> entry : data.entrySet())
6363
_dict.set(entry.getKey(), new MValue(CBLFleece.toCBLObject(entry.getValue())));
6464
return this;
6565
}

shared/src/main/java/com/couchbase/lite/MutableDictionaryInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
interface MutableDictionaryInterface extends DictionaryInterface {
77
// Set JSON or platform dictionary as a content.
8-
MutableDictionaryInterface set(Map<String, Object> dictionary);
8+
MutableDictionaryInterface setData(Map<String, Object> data);
99

1010
// set
1111
MutableDictionaryInterface setValue(String key, Object value);

shared/src/main/java/com/couchbase/lite/MutableDocument.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ public MutableDocument(String id) {
5757
* saved into a database when you call the Database's save(Document) method with the document
5858
* object given.
5959
*
60-
* @param dictionary the Map object
60+
* @param data the Map object
6161
*/
62-
public MutableDocument(Map<String, Object> dictionary) {
62+
public MutableDocument(Map<String, Object> data) {
6363
this((String) null);
64-
set(dictionary);
64+
setData(data);
6565
}
6666

6767
/**
@@ -72,12 +72,12 @@ public MutableDocument(Map<String, Object> dictionary) {
7272
* The created document will be saved into a database when you call
7373
* the Database's save(Document) method with the document object given.
7474
*
75-
* @param id the document ID.
76-
* @param dictionary the Map object
75+
* @param id the document ID.
76+
* @param data the Map object
7777
*/
78-
public MutableDocument(String id, Map<String, Object> dictionary) {
78+
public MutableDocument(String id, Map<String, Object> data) {
7979
this(id);
80-
set(dictionary);
80+
setData(data);
8181
}
8282

8383
MutableDocument(Document doc, Dictionary dict) {
@@ -100,12 +100,12 @@ public MutableDocument(String id, Map<String, Object> dictionary) {
100100
* Setting the new dictionary content will replace the current data including the existing Array
101101
* and Dictionary objects.
102102
*
103-
* @param dictionary the dictionary object.
103+
* @param data the dictionary object.
104104
* @return this Document instance
105105
*/
106106
@Override
107-
public MutableDocument set(Map<String, Object> dictionary) {
108-
((MutableDictionary) _dict).set(dictionary);
107+
public MutableDocument setData(Map<String, Object> data) {
108+
((MutableDictionary) _dict).setData(data);
109109
return this;
110110
}
111111

0 commit comments

Comments
 (0)