Java Over HTTP Vuser Functions > Alphabetical List of Functions > lrapi.lr2.fieldSetter

lrapi.lr2.fieldSetter

Example: fieldGetter and fieldSetter Java over HTTP Vuser Functions

Reflects an object and sets the value of a field.

public static Object fieldSetter(Object subject, String path, Object value) throws NoSuchFieldException, IllegalAccessException, ArrayIndexOutOfBoundsException 
Argument Description
subject The object to reflect. 
path The path to the array or member. 
value The value to set

fieldSetter reflects an object and sets the value of a field.

In specifying the path, members from inherited parent classes must be accessed using the super keyword. This is different that the default java behavior, which is access members directly.

If the type of the value argument is java.lang.Object, pass the Object or String itself. If the value is a primitive type, use either, a primitive argument or a string representation of the argument. For example, "true" or "false" for boolean, 321 or "321" for int.

Parameterization

Parameterization is not applicable to this function.