Interface Generator<T>

  • Type Parameters:
    T - the generic type
    All Superinterfaces:
    java.util.Iterator<T>
    All Known Subinterfaces:
    IdGenerator
    All Known Implementing Classes:
    UniqueIdGeneratorImpl, UniqueIdGeneratorSingleton

    public interface Generator<T>
    extends java.util.Iterator<T>
    A Generator generates objects of a dedicated type in mass production. The generated objects may have special characteristics or qualities, e.g the objects may be system wide unique from each other. These characteristics are implementation depended. The Iterator patters has been chosen to make the generator team up with the java collections framework.
    • Method Detail

      • hasNext

        boolean hasNext()
        Tests whether the Generator is capable of generating a next() item.
        Specified by:
        hasNext in interface java.util.Iterator<T>
        Returns:
        true, if successful
      • next

        T next()
        Generates a next item.
        Specified by:
        next in interface java.util.Iterator<T>
        Returns:
        The next item generated
        Throws:
        java.util.NoSuchElementException - in case the generator was not capable of generating a next item. Prevent this exception by first testing the Generator using hasNext().