Skip to content

Commit 26a91cd

Browse files
Remove unused Cursor/Box based find methods.
Also remove unused tests (this is now tested with queries).
1 parent d827648 commit 26a91cd

File tree

4 files changed

+0
-116
lines changed

4 files changed

+0
-116
lines changed

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -298,26 +298,6 @@ public boolean isEmpty() {
298298
return count(1) == 0;
299299
}
300300

301-
// @Temporary
302-
// public List<T> find(Property property, String value) {
303-
// Cursor<T> reader = getReader();
304-
// try {
305-
// return reader.find(property, value);
306-
// } finally {
307-
// releaseReader(reader);
308-
// }
309-
// }
310-
//
311-
// @Temporary
312-
// public List<T> find(Property property, long value) {
313-
// Cursor<T> reader = getReader();
314-
// try {
315-
// return reader.find(property, value);
316-
// } finally {
317-
// releaseReader(reader);
318-
// }
319-
// }
320-
321301
/**
322302
* Returns all stored Objects in this Box.
323303
*/

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ public abstract class Cursor<T> implements Closeable {
6060

6161
static native long nativeCount(long cursor, long maxCountOrZero);
6262

63-
static native List nativeFindScalarPropertyId(long cursor, int propertyId, long value);
64-
65-
static native List nativeFindStringPropertyId(long cursor, int propertyId, String value);
66-
6763
// TODO not implemented
6864
static native long nativeGetKey(long cursor);
6965

@@ -235,16 +231,6 @@ public int getPropertyId(String propertyName) {
235231
return nativePropertyId(cursor, propertyName);
236232
}
237233

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-
// }
247-
248234
/**
249235
* @return key or 0 if not found
250236
* @deprecated TODO only used in tests, remove in the future

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -245,30 +245,6 @@ public void testCollectionsNull() {
245245
box.removeByKeys(null);
246246
}
247247

248-
// @Test
249-
// public void testFindString() {
250-
// putTestEntity("banana", 0);
251-
// putTestEntity("apple", 0);
252-
// putTestEntity("banana", 0);
253-
//
254-
// List<TestEntity> list = box.find(TestEntity_.simpleString, "banana");
255-
// assertEquals(2, list.size());
256-
// assertEquals(1, list.get(0).getId());
257-
// assertEquals(3, list.get(1).getId());
258-
// }
259-
//
260-
// @Test
261-
// public void testFindInt() {
262-
// putTestEntity(null, 42);
263-
// putTestEntity(null, 23);
264-
// putTestEntity(null, 42);
265-
//
266-
// List<TestEntity> list = box.find(TestEntity_.simpleInt, 42);
267-
// assertEquals(2, list.size());
268-
// assertEquals(1, list.get(0).getId());
269-
// assertEquals(3, list.get(1).getId());
270-
// }
271-
272248
@Test
273249
public void testGetId() {
274250
TestEntity entity = putTestEntity(null, 42);

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

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -160,59 +160,6 @@ 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-
// }
215-
216163
private void insertTestEntities(String... texts) {
217164
Transaction transaction = store.beginTx();
218165
Cursor<TestEntity> cursor = transaction.createCursor(TestEntity.class);
@@ -223,11 +170,6 @@ private void insertTestEntities(String... texts) {
223170
transaction.commitAndClose();
224171
}
225172

226-
// @Test
227-
// public void testFindStringInEntityWithIndex() {
228-
// testFindStringInEntity();
229-
// }
230-
231173
@Test
232174
public void testLookupKeyUsingIndex() throws IOException {
233175
insertTestEntities("find me", "not me");

0 commit comments

Comments
 (0)