Package ratpack.func

Interface Factory<T>

  • Type Parameters:
    T - the type of object that this factory creates
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Factory<T>
    An object that creates another. Factories are expected to create a new object each time. Implementors should explain there behaviour if they do not do this.
    • Method Detail

      • create

        T create()
          throws Exception
        Creates a new object.
        Returns:
        a newly created object
        Throws:
        Exception - any
      • constant

        static <T> Factory<T> constant​(T item)
        Creates a factory that always returns the given item.
        Type Parameters:
        T - the type of the item
        Parameters:
        item - the item to always provide
        Returns:
        a factory that always returns item
        Since:
        1.1