Interface AccessorInvoker<T,​R>

  • Type Parameters:
    T - The type of the object from which the value should be retrieved
    R - The type of the return value
    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 AccessorInvoker<T,​R>
    Functional interface for accessing a value from 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 Function save the exceptions thrown, which is the reason for its existence.

    Since:
    5.0
    Author:
    Andrew Rucker Jones
    • Method Detail

      • invoke

        R invoke​(T object)
          throws java.lang.IllegalAccessException,
                 java.lang.reflect.InvocationTargetException
        Invoke the code to retrieve a value from a field.
        Parameters:
        object - The object from which the value of the field should be retrieved
        Returns:
        The value of the field from the given object
        Throws:
        java.lang.IllegalAccessException - If retrieval causes a problem
        java.lang.reflect.InvocationTargetException - If retrieval causes a problem