IComEnumVariantIterator (JNA API)

com.sun.jna.platform.win32.COM

## Class IComEnumVariantIterator

- java.lang.Object
- - com.sun.jna.platform.win32.COM.IComEnumVariantIterator

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable<Variant.VARIANT>, java.util.Iterator<Variant.VARIANT>

      public class IComEnumVariantIterator
      extends java.lang.Object
      implements java.lang.Iterable<Variant.VARIANT>, java.util.Iterator<Variant.VARIANT>, java.io.Closeable

  Wrapper for an EnumVariant Iteration. The usecase is a for-loop in the style:

       // Aquire an IDispatch, that has a new NewEnum Property (DISPID_NEWENUM)
       for(VARIANT v: IComEnumVariantIterator.wrap(dispatch)) {
            // Work with the acquired Variant
            // ...
            // Finally free it
            OleAuto.INSTANCE.VariantClear(v);
       }

  The `IComEnumVariantIterator` iterator closes the enumeration it wraps after the enumeration is exhausted or when the iterator is GCed, whatever happens earlier.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IComEnumVariantIterator(EnumVariant backingIteration)` IComEnumVariantIterator wraps the supplied EnumVariant and exposes that as an `Iterable<Variant.VARIANT>`/`Iterator<Variant.VARIANT>`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected void` | `finalize()`
    `boolean` | `hasNext()`
    `java.util.Iterator<Variant.VARIANT>` | `iterator()`
    `Variant.VARIANT` | `next()`
    `void` | `remove()`
    `static IComEnumVariantIterator` | `wrap(IDispatch dispatch)` Helper to get new enumeration from an `IDispatch`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining`

- - ### Constructor Detail

    - #### IComEnumVariantIterator

          public IComEnumVariantIterator(EnumVariant backingIteration)

      IComEnumVariantIterator wraps the supplied EnumVariant and exposes that as an `Iterable<Variant.VARIANT>`/`Iterator<Variant.VARIANT>`. The class takes possion of the supplied EnumVariant. So the EnumVariant is Released when the enumeration is exhausted or the Iterator is GCed.
      Parameters:
        `backingIteration` -

  - ### Method Detail

    - #### wrap

          public static IComEnumVariantIterator wrap(IDispatch dispatch)

      Helper to get new enumeration from an `IDispatch`.

      This expects, that the supplied IDispatch has a property identified by a `OaIdl.DISPID` of `OaIdl.DISPID_NEWENUM`

      Parameters:
        `dispatch` - IDispatch to be analysed
      Returns:
        IComEnumVariantIterator wrapping the enumeration queried from the supplied object

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `java.util.Iterator<Variant.VARIANT>`

    - #### next

          public Variant.VARIANT next()

      Specified by:
        `next` in interface `java.util.Iterator<Variant.VARIANT>`

    - #### close

          public void close()

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`

    - #### iterator

          public java.util.Iterator<Variant.VARIANT> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<Variant.VARIANT>`

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `java.util.Iterator<Variant.VARIANT>`

Copyright © 2007-2018 Timothy Wall. All Rights Reserved.