Package org.approvej.scrub
Class FieldScrubber<T>
java.lang.Object
org.approvej.scrub.FieldScrubber<T>
- Type Parameters:
T- the type of value to scrub
- All Implemented Interfaces:
Function<T,,T> UnaryOperator<T>,Scrubber<T>
Generic
Scrubber to set the value of a certain field via reflection.
Note that this requires that the field is generally mutable. Fields that are declared final
will cause a ScrubbingError when this is applied.
-
Method Details
-
apply
Scrubs the given value.- Specified by:
applyin interfaceFunction<T,T> - Parameters:
value- the object to be scrubbed- Returns:
- the scrubbed object
- Throws:
ScrubbingError- if the field cannot be edited
-
replacement
Sets the replacementObject.- Parameters:
replacement- the new replacementObject- Returns:
- this
-