if (retValue instanceof Collection) {
final Object[] proxyInfos = ((Collection) retValue).toArray();
final Vector proxies = new Vector();
for (int i = 0; i < proxyInfos.length; i++) {
final ProxyInfo proxyInfo = (ProxyInfo) proxyInfos[i];
proxies.addElement(createProxy(proxyInfo.getPrimaryKey(), getMainInterface()));
}
return proxies;
} else if (retValue instanceof ArrayEnumeration) {
final ArrayEnumeration enumeration = (ArrayEnumeration) retValue;
for (int i = enumeration.size() - 1; i >= 0; --i) {
final ProxyInfo proxyInfo = (ProxyInfo) enumeration.get(i);
enumeration.set(i, createProxy(proxyInfo.getPrimaryKey(), getMainInterface()));
}
return enumeration;
} else if (retValue instanceof Enumeration) {
final Enumeration enumeration = (Enumeration) retValue;
final List proxies = new ArrayList();
while (enumeration.hasMoreElements()) {
final ProxyInfo proxyInfo = (ProxyInfo) enumeration.nextElement();
proxies.add(createProxy(proxyInfo.getPrimaryKey(), getMainInterface()));
}
return new ArrayEnumeration(proxies);
} else {
final ProxyInfo proxyInfo = (ProxyInfo) retValue;
return createProxy(proxyInfo.getPrimaryKey(), getMainInterface());
}
}