Can a transient field in a class be obtained using reflection? (using getDeclaredField(..))
Can a transient field in a class be obtained using reflection? (using getDeclaredField(..) )
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, It is a normal field. You can check whether it is transient by:
So no logical reason for it not to be accessible by reflection. It’s the value of the field that is ignored (sometimes), not the field itself.
(btw, what hindered you from just trying to call
getDeclaredField("yourTransientField")?)