48
48
*
49
49
* @author Christoph Strobl
50
50
* @author Mark Paluch
51
+ * @author Junghoon Ban
51
52
* @since 1.7
52
53
*/
53
54
class RedisQueryEngine extends QueryEngine <RedisKeyValueAdapter , RedisOperationChain , Comparator <?>> {
@@ -89,7 +90,7 @@ private <T> List<T> doFind(RedisOperationChain criteria, long offset, int rows,
89
90
if (criteria == null
90
91
|| (CollectionUtils .isEmpty (criteria .getOrSismember ()) && CollectionUtils .isEmpty (criteria .getSismember ()))
91
92
&& criteria .getNear () == null ) {
92
- return getAdapter ().getAllOf (keyspace , type , offset , rows );
93
+ return getRequiredAdapter ().getAllOf (keyspace , type , offset , rows );
93
94
}
94
95
95
96
RedisCallback <Map <byte [], Map <byte [], byte []>>> callback = connection -> {
@@ -118,7 +119,8 @@ private <T> List<T> doFind(RedisOperationChain criteria, long offset, int rows,
118
119
}
119
120
}
120
121
121
- byte [] keyspaceBin = getAdapter ().getConverter ().getConversionService ().convert (keyspace + ":" , byte [].class );
122
+ byte [] keyspaceBin = getRequiredAdapter ().getConverter ().getConversionService ().convert (keyspace + ":" ,
123
+ byte [].class );
122
124
123
125
Map <byte [], Map <byte [], byte []>> rawData = new LinkedHashMap <>();
124
126
@@ -139,7 +141,7 @@ private <T> List<T> doFind(RedisOperationChain criteria, long offset, int rows,
139
141
return rawData ;
140
142
};
141
143
142
- Map <byte [], Map <byte [], byte []>> raw = this .getAdapter ().execute (callback );
144
+ Map <byte [], Map <byte [], byte []>> raw = this .getRequiredAdapter ().execute (callback );
143
145
144
146
List <T > result = new ArrayList <>(raw .size ());
145
147
for (Map .Entry <byte [], Map <byte [], byte []>> entry : raw .entrySet ()) {
@@ -149,10 +151,10 @@ private <T> List<T> doFind(RedisOperationChain criteria, long offset, int rows,
149
151
}
150
152
151
153
RedisData data = new RedisData (entry .getValue ());
152
- data .setId (getAdapter ().getConverter ().getConversionService ().convert (entry .getKey (), String .class ));
154
+ data .setId (getRequiredAdapter ().getConverter ().getConversionService ().convert (entry .getKey (), String .class ));
153
155
data .setKeyspace (keyspace );
154
156
155
- T converted = this .getAdapter ().getConverter ().read (type , data );
157
+ T converted = this .getRequiredAdapter ().getConverter ().read (type , data );
156
158
157
159
result .add (converted );
158
160
}
@@ -169,10 +171,10 @@ public Collection<?> execute(RedisOperationChain criteria, Comparator<?> sort, l
169
171
public long count (RedisOperationChain criteria , String keyspace ) {
170
172
171
173
if (criteria == null || criteria .isEmpty ()) {
172
- return this .getAdapter ().count (keyspace );
174
+ return this .getRequiredAdapter ().count (keyspace );
173
175
}
174
176
175
- return this .getAdapter ().execute (connection -> {
177
+ return this .getRequiredAdapter ().execute (connection -> {
176
178
177
179
long result = 0 ;
178
180
@@ -194,9 +196,9 @@ private byte[][] keys(String prefix, Collection<PathAndValue> source) {
194
196
int i = 0 ;
195
197
for (PathAndValue pathAndValue : source ) {
196
198
197
- byte [] convertedValue = getAdapter ().getConverter ().getConversionService (). convert ( pathAndValue . getFirstValue (),
198
- byte [].class );
199
- byte [] fullPath = getAdapter ().getConverter ().getConversionService ()
199
+ byte [] convertedValue = getRequiredAdapter ().getConverter ().getConversionService ()
200
+ . convert ( pathAndValue . getFirstValue (), byte [].class );
201
+ byte [] fullPath = getRequiredAdapter ().getConverter ().getConversionService ()
200
202
.convert (prefix + pathAndValue .getPath () + ":" , byte [].class );
201
203
202
204
keys [i ] = ByteUtils .concat (fullPath , convertedValue );
@@ -208,7 +210,7 @@ private byte[][] keys(String prefix, Collection<PathAndValue> source) {
208
210
private byte [] geoKey (String prefix , NearPath source ) {
209
211
210
212
String path = GeoIndexedPropertyValue .geoIndexName (source .getPath ());
211
- return getAdapter ().getConverter ().getConversionService ().convert (prefix + path , byte [].class );
213
+ return getRequiredAdapter ().getConverter ().getConversionService ().convert (prefix + path , byte [].class );
212
214
213
215
}
214
216
0 commit comments