Interface AssignmentInvoker<T,​U>

  • Type Parameters:
    T - The type of the object upon which the assignment code is to be invoked
    U - The type of the value that is to be assigned
    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 AssignmentInvoker<T,​U>
    Functional interface for assigning a value to a field.

    The field must be part of the code created for this functional interface, as there is no way to pass the field in during invocation.

    This interface is almost identical to BiConsumer save the exceptions thrown, which is the reason for its existence.

    Since:
    5.0
    Author:
    Andrew Rucker Jones
    • Method Detail

      • invoke

        void invoke​(T object,
                    U value)
             throws java.lang.IllegalAccessException,
                    java.lang.reflect.InvocationTargetException
        Invoke the code to assign a value to a field.
        Parameters:
        object - The object upon which the assignment method should be invoked
        value - The value to assign to a member variable of the given object
        Throws:
        java.lang.IllegalAccessException - If assignment causes a problem
        java.lang.reflect.InvocationTargetException - If assignment causes a problem