Example usage for org.apache.commons.collections4 IteratorUtils asIterator

List of usage examples for org.apache.commons.collections4 IteratorUtils asIterator

Introduction

In this page you can find the example usage for org.apache.commons.collections4 IteratorUtils asIterator.

Prototype

public static <E> Iterator<E> asIterator(final Enumeration<? extends E> enumeration) 

Source Link

Document

Gets an iterator that provides an iterator view of the given enumeration.

Usage

From source file:org.molasdin.wbase.jsf.spring.web.SpringBeansRewireListener.java

@Override
public void sessionDidActivate(HttpSessionEvent httpSessionEvent) {
    HttpSession session = httpSessionEvent.getSession();
    WebApplicationContext ctx = WebApplicationContextUtils
            .getRequiredWebApplicationContext(session.getServletContext());
    AutowireCapableBeanFactory bf = ctx.getAutowireCapableBeanFactory();
    for (String entry : IteratorUtils.asIterable(IteratorUtils.asIterator(session.getAttributeNames()))) {
        if (bf.containsBean(entry)) {
            Object bean = session.getAttribute(entry);
            bean = bf.configureBean(bean, entry);
            session.setAttribute(entry, bean);
        }/*from  www.  j a  v  a2 s.  co  m*/
    }

}