Skip to content

Commit 650f0e1

Browse files
committed
comment out Box/Cursor based find methods
1 parent 48aca68 commit 650f0e1

File tree

4 files changed

+112
-112
lines changed

4 files changed

+112
-112
lines changed

objectbox-java/src/main/java/io/objectbox/Box.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -299,25 +299,25 @@ public boolean isEmpty() {
299299
return count(1) == 0;
300300
}
301301

302-
@Temporary
303-
public List<T> find(Property property, String value) {
304-
Cursor<T> reader = getReader();
305-
try {
306-
return reader.find(property, value);
307-
} finally {
308-
releaseReader(reader);
309-
}
310-
}
311-
312-
@Temporary
313-
public List<T> find(Property property, long value) {
314-
Cursor<T> reader = getReader();
315-
try {
316-
return reader.find(property, value);
317-
} finally {
318-
releaseReader(reader);
319-
}
320-
}
302+
// @Temporary
303+
// public List<T> find(Property property, String value) {
304+
// Cursor<T> reader = getReader();
305+
// try {
306+
// return reader.find(property, value);
307+
// } finally {
308+
// releaseReader(reader);
309+
// }
310+
// }
311+
//
312+
// @Temporary
313+
// public List<T> find(Property property, long value) {
314+
// Cursor<T> reader = getReader();
315+
// try {
316+
// return reader.find(property, value);
317+
// } finally {
318+
// releaseReader(reader);
319+
// }
320+
// }
321321

322322
/**
323323
* Returns all stored Objects in this Box.

objectbox-java/src/main/java/io/objectbox/Cursor.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,15 @@ public int getPropertyId(String propertyName) {
235235
return nativePropertyId(cursor, propertyName);
236236
}
237237

238-
@Temporary
239-
public List<T> find(Property property, long value) {
240-
return nativeFindScalarPropertyId(cursor, property.id, value);
241-
}
242-
243-
@Temporary
244-
public List<T> find(Property property, String value) {
245-
return nativeFindStringPropertyId(cursor, property.id, value);
246-
}
238+
// @Temporary
239+
// public List<T> find(Property property, long value) {
240+
// return nativeFindScalarPropertyId(cursor, property.id, value);
241+
// }
242+
//
243+
// @Temporary
244+
// public List<T> find(Property property, String value) {
245+
// return nativeFindStringPropertyId(cursor, property.id, value);
246+
// }
247247

248248
/**
249249
* @return key or 0 if not found

tests/objectbox-java-test/src/test/java/io/objectbox/BoxTest.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -220,29 +220,29 @@ public void testCollectionsNull() {
220220
box.removeByKeys(null);
221221
}
222222

223-
@Test
224-
public void testFindString() {
225-
putTestEntity("banana", 0);
226-
putTestEntity("apple", 0);
227-
putTestEntity("banana", 0);
228-
229-
List<TestEntity> list = box.find(TestEntity_.simpleString, "banana");
230-
assertEquals(2, list.size());
231-
assertEquals(1, list.get(0).getId());
232-
assertEquals(3, list.get(1).getId());
233-
}
234-
235-
@Test
236-
public void testFindInt() {
237-
putTestEntity(null, 42);
238-
putTestEntity(null, 23);
239-
putTestEntity(null, 42);
240-
241-
List<TestEntity> list = box.find(TestEntity_.simpleInt, 42);
242-
assertEquals(2, list.size());
243-
assertEquals(1, list.get(0).getId());
244-
assertEquals(3, list.get(1).getId());
245-
}
223+
// @Test
224+
// public void testFindString() {
225+
// putTestEntity("banana", 0);
226+
// putTestEntity("apple", 0);
227+
// putTestEntity("banana", 0);
228+
//
229+
// List<TestEntity> list = box.find(TestEntity_.simpleString, "banana");
230+
// assertEquals(2, list.size());
231+
// assertEquals(1, list.get(0).getId());
232+
// assertEquals(3, list.get(1).getId());
233+
// }
234+
//
235+
// @Test
236+
// public void testFindInt() {
237+
// putTestEntity(null, 42);
238+
// putTestEntity(null, 23);
239+
// putTestEntity(null, 42);
240+
//
241+
// List<TestEntity> list = box.find(TestEntity_.simpleInt, 42);
242+
// assertEquals(2, list.size());
243+
// assertEquals(1, list.get(0).getId());
244+
// assertEquals(3, list.get(1).getId());
245+
// }
246246

247247
@Test
248248
public void testGetId() {

tests/objectbox-java-test/src/test/java/io/objectbox/CursorTest.java

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void testPutGetUpdateDeleteEntity() {
101101

102102
// and find via index
103103
assertEquals(key, cursor.lookupKeyUsingIndex(9, value1));
104-
assertEquals(key, cursor.find(TestEntity_.simpleString, value1).get(0).getId());
104+
// assertEquals(key, cursor.find(TestEntity_.simpleString, value1).get(0).getId());
105105

106106
// change entity values
107107
String value2 = "lala123";
@@ -112,10 +112,10 @@ public void testPutGetUpdateDeleteEntity() {
112112
cursor.put(entityRead);
113113

114114
// indexes ok?
115-
assertEquals(0, cursor.find(TestEntity_.simpleString, value1).size());
115+
// assertEquals(0, cursor.find(TestEntity_.simpleString, value1).size());
116116
assertEquals(0, cursor.lookupKeyUsingIndex(9, value1));
117117

118-
assertEquals(key, cursor.find(TestEntity_.simpleString, value2).get(0).getId());
118+
// assertEquals(key, cursor.find(TestEntity_.simpleString, value2).get(0).getId());
119119

120120
// get the changed entity
121121
entityRead = cursor.get(key);
@@ -130,8 +130,8 @@ public void testPutGetUpdateDeleteEntity() {
130130
cursor.deleteEntity(key);
131131

132132
// not in any index anymore
133-
assertEquals(0, cursor.find(TestEntity_.simpleString, value1).size());
134-
assertEquals(0, cursor.find(TestEntity_.simpleString, value2).size());
133+
// assertEquals(0, cursor.find(TestEntity_.simpleString, value1).size());
134+
// assertEquals(0, cursor.find(TestEntity_.simpleString, value2).size());
135135

136136
cursor.close();
137137
transaction.abort();
@@ -160,58 +160,58 @@ public void testPutSameIndexValue() {
160160
assertEquals(value, read.getSimpleString());
161161
}
162162

163-
@Test
164-
public void testFindStringInEntity() {
165-
insertTestEntities("find me", "not me");
166-
167-
Transaction transaction = store.beginTx();
168-
Cursor<TestEntity> cursor = transaction.createCursor(TestEntity.class);
169-
TestEntity entityRead = cursor.find(TestEntity_.simpleString, "find me").get(0);
170-
assertNotNull(entityRead);
171-
assertEquals(1, entityRead.getId());
172-
173-
cursor.close();
174-
transaction.abort();
175-
176-
transaction = store.beginTx();
177-
cursor = transaction.createCursor(TestEntity.class);
178-
entityRead = cursor.find(TestEntity_.simpleString, "not me").get(0);
179-
assertNotNull(entityRead);
180-
assertEquals(2, entityRead.getId());
181-
182-
cursor.close();
183-
transaction.abort();
184-
185-
transaction = store.beginTx();
186-
cursor = transaction.createCursor(TestEntity.class);
187-
assertEquals(0, cursor.find(TestEntity_.simpleString, "non-existing").size());
188-
189-
cursor.close();
190-
transaction.abort();
191-
}
192-
193-
@Test
194-
public void testFindScalars() {
195-
Transaction transaction1 = store.beginTx();
196-
Cursor<TestEntity> cursor1 = transaction1.createCursor(TestEntity.class);
197-
putEntity(cursor1, "nope", 2015);
198-
putEntity(cursor1, "foo", 2016);
199-
putEntity(cursor1, "bar", 2016);
200-
putEntity(cursor1, "nope", 2017);
201-
cursor1.close();
202-
transaction1.commit();
203-
204-
Transaction transaction = store.beginReadTx();
205-
Cursor<TestEntity> cursor = transaction.createCursor(TestEntity.class);
206-
List<TestEntity> result = cursor.find(TestEntity_.simpleInt, 2016);
207-
assertEquals(2, result.size());
208-
209-
assertEquals("foo", result.get(0).getSimpleString());
210-
assertEquals("bar", result.get(1).getSimpleString());
211-
212-
cursor.close();
213-
transaction.abort();
214-
}
163+
// @Test
164+
// public void testFindStringInEntity() {
165+
// insertTestEntities("find me", "not me");
166+
//
167+
// Transaction transaction = store.beginTx();
168+
// Cursor<TestEntity> cursor = transaction.createCursor(TestEntity.class);
169+
// TestEntity entityRead = cursor.find(TestEntity_.simpleString, "find me").get(0);
170+
// assertNotNull(entityRead);
171+
// assertEquals(1, entityRead.getId());
172+
//
173+
// cursor.close();
174+
// transaction.abort();
175+
//
176+
// transaction = store.beginTx();
177+
// cursor = transaction.createCursor(TestEntity.class);
178+
// entityRead = cursor.find(TestEntity_.simpleString, "not me").get(0);
179+
// assertNotNull(entityRead);
180+
// assertEquals(2, entityRead.getId());
181+
//
182+
// cursor.close();
183+
// transaction.abort();
184+
//
185+
// transaction = store.beginTx();
186+
// cursor = transaction.createCursor(TestEntity.class);
187+
// assertEquals(0, cursor.find(TestEntity_.simpleString, "non-existing").size());
188+
//
189+
// cursor.close();
190+
// transaction.abort();
191+
// }
192+
193+
// @Test
194+
// public void testFindScalars() {
195+
// Transaction transaction1 = store.beginTx();
196+
// Cursor<TestEntity> cursor1 = transaction1.createCursor(TestEntity.class);
197+
// putEntity(cursor1, "nope", 2015);
198+
// putEntity(cursor1, "foo", 2016);
199+
// putEntity(cursor1, "bar", 2016);
200+
// putEntity(cursor1, "nope", 2017);
201+
// cursor1.close();
202+
// transaction1.commit();
203+
//
204+
// Transaction transaction = store.beginReadTx();
205+
// Cursor<TestEntity> cursor = transaction.createCursor(TestEntity.class);
206+
// List<TestEntity> result = cursor.find(TestEntity_.simpleInt, 2016);
207+
// assertEquals(2, result.size());
208+
//
209+
// assertEquals("foo", result.get(0).getSimpleString());
210+
// assertEquals("bar", result.get(1).getSimpleString());
211+
//
212+
// cursor.close();
213+
// transaction.abort();
214+
// }
215215

216216
private void insertTestEntities(String... texts) {
217217
Transaction transaction = store.beginTx();
@@ -223,10 +223,10 @@ private void insertTestEntities(String... texts) {
223223
transaction.commitAndClose();
224224
}
225225

226-
@Test
227-
public void testFindStringInEntityWithIndex() {
228-
testFindStringInEntity();
229-
}
226+
// @Test
227+
// public void testFindStringInEntityWithIndex() {
228+
// testFindStringInEntity();
229+
// }
230230

231231
@Test
232232
public void testLookupKeyUsingIndex() throws IOException {

0 commit comments

Comments
 (0)