* @throws PageException
*/
public static Iterator toIterator(Object o) throws PageException {
if(o instanceof Iterator) return (Iterator)o;
else if(o instanceof Iteratorable) return ((Iteratorable)o).keysAsStringIterator();
else if(o instanceof Enumeration) return new IteratorWrapper((Enumeration)o);
else if(o instanceof JavaObject) {
String[] names = ClassUtil.getFieldNames(((JavaObject)o).getClazz());
return new ArrayIterator(names);
}
else if(o instanceof ObjectWrap) return toIterator(((ObjectWrap)o).getEmbededObject());