ch.lambdaj.proxy.ProxyIterator Maven / Gradle / Ivy
// Modified or written by Ex Machina SAGL for inclusion with lambdaj.
// Copyright (c) 2009 Mario Fusco.
// Licensed under the Apache License, Version 2.0 (the "License")
package ch.lambdaj.proxy;
import static ch.lambdaj.proxy.ProxyUtil.*;
import ch.lambdaj.util.iterator.*;
import java.lang.reflect.*;
import java.util.*;
/**
* Proxies a list of objects in order to seamlessly iterate on them by exposing the API of a single object.
* @author Mario Fusco
*/
public class ProxyIterator extends InvocationInterceptor implements Iterable {
private final ResettableIterator extends T> proxiedIterator;
protected ProxyIterator(ResettableIterator extends T> proxiedIterator) {
this.proxiedIterator = proxiedIterator;
}
public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
if (method.getName().equals("iterator")) return iterator();
return createProxyIterator(iterateOnValues(method, args), (Class © 2015 - 2025 Weber Informatics LLC | Privacy Policy