@Override @SuppressWarnings("unchecked") public Query parse() throws SyntaxError { Method method = Method.valueOf(localParams.get(METHOD, Method.termsFilter.name())); JoinSpec<T> js = JoinSpec.parse(localParams.get(QueryParsing.V)); Iterator<T> it = js.iterator(this); if (joinField == null) { throw new Exception("No XJoin component referenced by query"); } FieldType ft = req.getSchema().getFieldTypeNoEx(joinField); Iterator<BytesRef> bytesRefs = new TransformIterator(it, transformer(ft)); if (! bytesRefs.hasNext()) { return new BooleanQuery.Builder().build(); // matches nothing } Query query = method.makeQuery(joinField, bytesRefs); return new SolrConstantScoreQuery(new QueryWrapperFilter(query)); }
@Override @SuppressWarnings("unchecked") public Query parse() throws SyntaxError { Method method = Method.valueOf(localParams.get(METHOD, Method.termsFilter.name())); JoinSpec<T> js = JoinSpec.parse(localParams.get(QueryParsing.V)); Iterator<T> it = js.iterator(this); if (joinField == null) { throw new Exception("No XJoin component referenced by query"); } FieldType ft = req.getSchema().getFieldTypeNoEx(joinField); Iterator<BytesRef> bytesRefs = new TransformIterator(it, transformer(ft)); if (! bytesRefs.hasNext()) { return new BooleanQuery(); // matches nothing } return new SolrConstantScoreQuery(method.makeFilter(joinField, bytesRefs)); }
public Set entrySet() { return new AbstractSet() { public int size() { return array.length; } public Iterator iterator() { return new TransformIterator(new ObjectArrayIterator(array), transformer); } }; }
@SuppressWarnings("unchecked") @Override public Iterator<Configuration> iterator() { TransformIterator it = new TransformIterator( new IntegerSequenceIterator(), new ConfigurationTranformer( param)); return it; }
@SuppressWarnings("unchecked") @Override public Iterator<Configuration> iterator() { TransformIterator it = new TransformIterator( new DoubleSequenceIterator(), new ConfigurationTranformer(param)); return it; }
@SuppressWarnings("unchecked") @Override public Iterator<Configuration> iterator() { TransformIterator tIt = new TransformIterator(values.iterator(), new ConfigurationTranformer(param)); return tIt; }
@SuppressWarnings("unchecked") @Override public Iterator<Configuration> iterator() { SingletonIterator it = new SingletonIterator(value, false); TransformIterator itConfig = new TransformIterator(it, new ConfigurationTranformer(param)); return itConfig; }
public Iterator<CacheKey> iterateCacheKeys() { return new TransformIterator(linkedList.iterator(), new Transformer() { public Object transform(Object o) { return ((CacheEntry) o).key; } }); }
public Iterator<Object> iterateCacheObjects() { return new TransformIterator(linkedList.iterator(), new Transformer() { public Object transform(Object o) { return ((CacheEntry) o).cacheable; } }); }
/** * Returns an iterator with elements of an original <code>iterator</code> transformed by * a <code>transformer</code>. * * @param <T> * @param <R> * @param <S> * @param iterator * @param transformer * @return */ @SuppressWarnings("unchecked") public static <T, R, S extends T> Iterator<R> transformIterator(Iterator<? extends T> iterator, final Transformer<S, ? super R> transformer) { return new TransformIterator(iterator, new org.apache.commons.collections.Transformer() { public Object transform(Object input) { return transformer.transform((S) input); } }); }