Package railo.runtime.com

Source Code of railo.runtime.com.COMKeyWrapperIterator

package railo.runtime.com;

import java.util.Iterator;

import railo.runtime.exp.CasterException;
import railo.runtime.exp.PageRuntimeException;
import railo.runtime.op.Caster;
import railo.runtime.type.Collection;

import com.jacob.com.EnumVariant;

/**
* MUST this is a value iterator instead of a key iterator
*
*/
public final class COMKeyWrapperIterator implements Iterator<Collection.Key> {

    private EnumVariant enumVariant;
    private COMObject wrapper;

    /**
     * @param wrapper
     */
    public COMKeyWrapperIterator(COMObject wrapper) {
        this.enumVariant=new EnumVariant(wrapper.getDispatch());
        this.wrapper=wrapper;
    }

    @Override
    public void remove() {
        enumVariant.safeRelease();
    }

    @Override
    public boolean hasNext() {
        return enumVariant.hasMoreElements();
    }

    @Override
    public Collection.Key next() {
        try {
      return Caster.toKey(COMUtil.toObject(wrapper,enumVariant.Next(),"",null));
    } catch (CasterException e) {
      throw new PageRuntimeException(e);
    }
    }
}
TOP

Related Classes of railo.runtime.com.COMKeyWrapperIterator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.