1 package com.opencsv.bean.function;
2
3 import java.lang.reflect.InvocationTargetException;
4
5 /**
6 * Functional interface for assigning a value to a field.
7 * <p>The field must be part of the code created for this functional interface,
8 * as there is no way to pass the field in during invocation.</p>
9 * <p>This interface is almost identical to {@link java.util.function.BiConsumer}
10 * save the exceptions thrown, which is the reason for its existence.</p>
11 *
12 * @param <T> The type of the object upon which the assignment code is to be
13 * invoked
14 * @param <U> The type of the value that is to be assigned
15 * @author Andrew Rucker Jones
16 * @since 5.0
17 */
18 @FunctionalInterface
19 public interface AssignmentInvoker<T, U> {
20
21 /**
22 * Invoke the code to assign a value to a field.
23 *
24 * @param object The object upon which the assignment method should be
25 * invoked
26 * @param value The value to assign to a member variable of the given
27 * object
28 *
29 * @throws IllegalAccessException If assignment causes a problem
30 * @throws InvocationTargetException If assignment causes a problem
31 */
32 void invoke(T object, U value) throws IllegalAccessException, InvocationTargetException;
33 }