DATAMONGO-2314 - Polishing.
Reformat code. Remove unnecessary warning suppressions. Switch to diamond syntax. Original pull request: #771.
This commit is contained in:
@@ -130,10 +130,8 @@ public class QueryMapper {
|
|||||||
// TODO: remove one once QueryMapper can work with Query instances directly
|
// TODO: remove one once QueryMapper can work with Query instances directly
|
||||||
if (Query.isRestrictedTypeKey(key)) {
|
if (Query.isRestrictedTypeKey(key)) {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Set<Class<?>> restrictedTypes = BsonUtils.get(query, key);
|
Set<Class<?>> restrictedTypes = BsonUtils.get(query, key);
|
||||||
this.converter.getTypeMapper().writeTypeRestrictions(result, restrictedTypes);
|
this.converter.getTypeMapper().writeTypeRestrictions(result, restrictedTypes);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +269,7 @@ public class QueryMapper {
|
|||||||
if (keyword.isOrOrNor() || (keyword.hasIterableValue() && !keyword.isGeometry())) {
|
if (keyword.isOrOrNor() || (keyword.hasIterableValue() && !keyword.isGeometry())) {
|
||||||
|
|
||||||
Iterable<?> conditions = keyword.getValue();
|
Iterable<?> conditions = keyword.getValue();
|
||||||
List<Object> newConditions = new ArrayList<Object>();
|
List<Object> newConditions = new ArrayList<>();
|
||||||
|
|
||||||
for (Object condition : conditions) {
|
for (Object condition : conditions) {
|
||||||
newConditions.add(isDocument(condition) ? getMappedObject((Document) condition, entity)
|
newConditions.add(isDocument(condition) ? getMappedObject((Document) condition, entity)
|
||||||
@@ -282,11 +280,12 @@ public class QueryMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (keyword.isSample()) {
|
if (keyword.isSample()) {
|
||||||
return exampleMapper.getMappedExample(keyword.<Example<?>> getValue(), entity);
|
return exampleMapper.getMappedExample(keyword.getValue(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyword.isJsonSchema()) {
|
if (keyword.isJsonSchema()) {
|
||||||
return schemaMapper.mapSchema(new Document(keyword.getKey(), keyword.getValue()), entity != null ? entity.getType() : Object.class);
|
return schemaMapper.mapSchema(new Document(keyword.getKey(), keyword.getValue()),
|
||||||
|
entity != null ? entity.getType() : Object.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Document(keyword.getKey(), convertSimpleOrDocument(keyword.getValue(), entity));
|
return new Document(keyword.getKey(), convertSimpleOrDocument(keyword.getValue(), entity));
|
||||||
@@ -334,7 +333,7 @@ public class QueryMapper {
|
|||||||
|
|
||||||
if (valueDbo.containsField("$in") || valueDbo.containsField("$nin")) {
|
if (valueDbo.containsField("$in") || valueDbo.containsField("$nin")) {
|
||||||
String inKey = valueDbo.containsField("$in") ? "$in" : "$nin";
|
String inKey = valueDbo.containsField("$in") ? "$in" : "$nin";
|
||||||
List<Object> ids = new ArrayList<Object>();
|
List<Object> ids = new ArrayList<>();
|
||||||
for (Object id : (Iterable<?>) valueDbo.get(inKey)) {
|
for (Object id : (Iterable<?>) valueDbo.get(inKey)) {
|
||||||
ids.add(convertId(id));
|
ids.add(convertId(id));
|
||||||
}
|
}
|
||||||
@@ -353,7 +352,7 @@ public class QueryMapper {
|
|||||||
|
|
||||||
if (valueDbo.containsKey("$in") || valueDbo.containsKey("$nin")) {
|
if (valueDbo.containsKey("$in") || valueDbo.containsKey("$nin")) {
|
||||||
String inKey = valueDbo.containsKey("$in") ? "$in" : "$nin";
|
String inKey = valueDbo.containsKey("$in") ? "$in" : "$nin";
|
||||||
List<Object> ids = new ArrayList<Object>();
|
List<Object> ids = new ArrayList<>();
|
||||||
for (Object id : (Iterable<?>) valueDbo.get(inKey)) {
|
for (Object id : (Iterable<?>) valueDbo.get(inKey)) {
|
||||||
ids.add(convertId(id));
|
ids.add(convertId(id));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user