Skip to content

Commit 593e01d

Browse files
chore(datastore) remove overloaded query method in favor of just one (#1092)
1 parent cf02ebe commit 593e01d

File tree

6 files changed

+6
-40
lines changed

6 files changed

+6
-40
lines changed

aws-datastore/src/main/java/com/amplifyframework/datastore/AWSDataStorePlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ public <T extends Model> void query(
379379
@NonNull Class<T> itemClass,
380380
@NonNull Consumer<Iterator<T>> onQueryResults,
381381
@NonNull Consumer<DataStoreException> onQueryFailure) {
382-
start(() -> sqliteStorageAdapter.query(itemClass, onQueryResults, onQueryFailure), onQueryFailure);
382+
start(() ->
383+
sqliteStorageAdapter.query(itemClass, Where.matchesAll(), onQueryResults, onQueryFailure), onQueryFailure);
383384
}
384385

385386
/**

aws-datastore/src/main/java/com/amplifyframework/datastore/storage/LocalStorageAdapter.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,6 @@ <T extends Model> void save(
8484
@NonNull Consumer<DataStoreException> onError
8585
);
8686

87-
/**
88-
* Query the storage for items of a given type.
89-
* @param itemClass Items that have this class will be solicited
90-
* @param onSuccess A callback that will be invoked if the query succeeds
91-
* @param onError A callback that will be invoked if the query fails with an error
92-
* @param <T> Type type of the items that are being queried
93-
*/
94-
<T extends Model> void query(
95-
@NonNull Class<T> itemClass,
96-
@NonNull Consumer<Iterator<T>> onSuccess,
97-
@NonNull Consumer<DataStoreException> onError
98-
);
99-
10087
/**
10188
* Query the storage for items of a given type with specific conditions.
10289
* @param itemClass Items that have this class will be solicited

aws-datastore/src/main/java/com/amplifyframework/datastore/storage/sqlite/PersistentModelVersion.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.amplifyframework.core.model.Model;
2222
import com.amplifyframework.core.model.ModelProvider;
2323
import com.amplifyframework.core.model.annotations.ModelField;
24+
import com.amplifyframework.core.model.query.Where;
2425
import com.amplifyframework.core.model.query.predicate.QueryPredicates;
2526
import com.amplifyframework.datastore.storage.LocalStorageAdapter;
2627
import com.amplifyframework.datastore.storage.StorageItemChange;
@@ -71,6 +72,7 @@ static Single<Iterator<PersistentModelVersion>> fromLocalStorage(@NonNull LocalS
7172
return Single.create(emitter ->
7273
localStorageAdapter.query(
7374
PersistentModelVersion.class,
75+
Where.matchesAll(),
7476
emitter::onSuccess,
7577
emitter::onError
7678
)

aws-datastore/src/main/java/com/amplifyframework/datastore/storage/sqlite/SQLiteStorageAdapter.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import com.amplifyframework.core.model.ModelSchema;
3636
import com.amplifyframework.core.model.ModelSchemaRegistry;
3737
import com.amplifyframework.core.model.query.QueryOptions;
38-
import com.amplifyframework.core.model.query.Where;
3938
import com.amplifyframework.core.model.query.predicate.QueryField;
4039
import com.amplifyframework.core.model.query.predicate.QueryPredicate;
4140
import com.amplifyframework.core.model.query.predicate.QueryPredicateOperation;
@@ -344,20 +343,6 @@ public <T extends Model> void save(
344343
});
345344
}
346345

347-
/**
348-
* {@inheritDoc}
349-
*/
350-
@Override
351-
public <T extends Model> void query(
352-
@NonNull Class<T> itemClass,
353-
@NonNull Consumer<Iterator<T>> onSuccess,
354-
@NonNull Consumer<DataStoreException> onError) {
355-
Objects.requireNonNull(itemClass);
356-
Objects.requireNonNull(onSuccess);
357-
Objects.requireNonNull(onError);
358-
query(itemClass, Where.matchesAll(), onSuccess, onError);
359-
}
360-
361346
/**
362347
* {@inheritDoc}
363348
*/

aws-datastore/src/main/java/com/amplifyframework/datastore/syncengine/PersistentMutationOutbox.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.amplifyframework.core.Amplify;
2424
import com.amplifyframework.core.model.Model;
2525
import com.amplifyframework.core.model.ModelSchema;
26+
import com.amplifyframework.core.model.query.Where;
2627
import com.amplifyframework.core.model.query.predicate.QueryPredicate;
2728
import com.amplifyframework.core.model.query.predicate.QueryPredicates;
2829
import com.amplifyframework.datastore.DataStoreException;
@@ -181,7 +182,7 @@ public Completable load() {
181182
return Completable.create(emitter -> {
182183
inFlightMutations.clear();
183184
mutationQueue.clear();
184-
storage.query(PendingMutation.PersistentRecord.class,
185+
storage.query(PendingMutation.PersistentRecord.class, Where.matchesAll(),
185186
results -> {
186187
while (results.hasNext()) {
187188
try {

aws-datastore/src/test/java/com/amplifyframework/datastore/storage/InMemoryStorageAdapter.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.amplifyframework.core.model.Model;
2626
import com.amplifyframework.core.model.ModelSchema;
2727
import com.amplifyframework.core.model.query.QueryOptions;
28-
import com.amplifyframework.core.model.query.Where;
2928
import com.amplifyframework.core.model.query.predicate.QueryPredicate;
3029
import com.amplifyframework.datastore.DataStoreException;
3130

@@ -109,15 +108,6 @@ public <T extends Model> void save(
109108
onSuccess.accept(change);
110109
}
111110

112-
@Override
113-
public <T extends Model> void query(
114-
@NonNull final Class<T> itemClass,
115-
@NonNull final Consumer<Iterator<T>> onSuccess,
116-
@NonNull final Consumer<DataStoreException> onError
117-
) {
118-
query(itemClass, Where.matchesAll(), onSuccess, onError);
119-
}
120-
121111
@SuppressWarnings("unchecked") // (T) item *is* checked, via isAssignableFrom().
122112
@Override
123113
public <T extends Model> void query(

0 commit comments

Comments
 (0)