Class FunctionalConstructor<T>

  • Type Parameters:
    T - the type of the class.

    public final class FunctionalConstructor<T>
    extends java.lang.Object
    A lambda wrapper around the no-arg constructor of a class. The wrapped contructor can be used as a lambda with new FunctionalConstructor(c)::invoke.
    • Constructor Summary

      Constructors 
      Constructor Description
      FunctionalConstructor​(@NonNull java.lang.reflect.Constructor<T> ctor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      @NonNull java.lang.reflect.Constructor<T> getCtor()
      The no-arg constructor
      int hashCode()  
      T newInstance()
      Creates a new instance.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FunctionalConstructor

        public FunctionalConstructor​(@NonNull
                                     @NonNull java.lang.reflect.Constructor<T> ctor)
    • Method Detail

      • newInstance

        public T newInstance()
        Creates a new instance.
        Returns:
        the new instance.
        Throws:
        java.lang.IllegalStateException - if any InstantiationException occurs
        Sneaky Throws:
        IllegalAccessException, Exception if any InvocationTargetException occurs
      • getCtor

        @NonNull
        public @NonNull java.lang.reflect.Constructor<T> getCtor()
        The no-arg constructor
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object