Document proxy support in ReflectionTestUtils

Issue: SPR-14050
This commit is contained in:
Sam Brannen 2016-03-15 19:15:38 +01:00
parent 2d565c7944
commit b1ca18e0dc
1 changed files with 7 additions and 0 deletions

View File

@ -138,6 +138,9 @@ public class ReflectionTestUtils {
* Set the {@linkplain Field field} with the given {@code name}/{@code type}
* on the provided {@code targetObject}/{@code targetClass} to the supplied
* {@code value}.
* <p>If the supplied {@code targetObject} is a <em>proxy</em>, it will
* be {@linkplain AopTestUtils#getUltimateTargetObject unwrapped} allowing
* the field to be set on the ultimate target of the proxy.
* <p>This method traverses the class hierarchy in search of the desired
* field. In addition, an attempt will be made to make non-{@code public}
* fields <em>accessible</em>, thus allowing one to set {@code protected},
@ -154,6 +157,7 @@ public class ReflectionTestUtils {
* @see ReflectionUtils#findField(Class, String, Class)
* @see ReflectionUtils#makeAccessible(Field)
* @see ReflectionUtils#setField(Field, Object, Object)
* @see AopTestUtils#getUltimateTargetObject(Object)
* @since 4.2
*/
public static void setField(Object targetObject, Class<?> targetClass, String name, Object value, Class<?> type) {
@ -217,6 +221,9 @@ public class ReflectionTestUtils {
/**
* Get the value of the {@linkplain Field field} with the given {@code name}
* from the provided {@code targetObject}/{@code targetClass}.
* <p>If the supplied {@code targetObject} is a <em>proxy</em>, it will
* be {@linkplain AopTestUtils#getUltimateTargetObject unwrapped} allowing
* the field to be retrieved from the ultimate target of the proxy.
* <p>This method traverses the class hierarchy in search of the desired
* field. In addition, an attempt will be made to make non-{@code public}
* fields <em>accessible</em>, thus allowing one to get {@code protected},