use of lucee.runtime.type.it.EnumAsIt in project Lucee by lucee.
the class ForEachUtil method _toIterator.
private static Iterator _toIterator(Object o) {
if (o instanceof Iteratorable) {
return ((Iteratorable) o).keysAsStringIterator();
}
if (o instanceof Iterator) {
return (Iterator) o;
}
if (o instanceof Enumeration) {
return new EnumAsIt((Enumeration) o);
}
if (o instanceof JavaObject) {
Collection coll = Caster.toCollection(((JavaObject) o).getEmbededObject(null), null);
if (coll != null)
return coll.getIterator();
String[] names = ClassUtil.getFieldNames(((JavaObject) o).getClazz());
return new ArrayIterator(names);
} else if (o instanceof CharSequence) {
return ListUtil.listToArray(o.toString(), ',').getIterator();
}
return null;
}
Aggregations