The getField method will only find the field if it’s public. You will need to use the getDeclaredField method instead, which will find any field that is declared directly on the class, even if it’s not public.
The getField method will only find the field if it’s public. You will need to use the getDeclaredField method instead, which will find any field that is declared directly on the class, even if it’s not public.