I am working on a project where I was asked to make it so that the user can enter attributes that they want obscured from a .yml
config file. The attribute already has a value in it and it will be set to null
based on whether the user wants that attribute obscured.
For example if the variable String country = "Canada";
exists and the user specifies "country"
in the config file, country will be set to null
.
The class has get
and set
methods. But I don't really understand how I can set the attributes to null
.
For example, I'd have to set the value to null like Object.setCountry=null;
but I won't know what set method to use Object.xxxx=null;
I used reflection to solve this issue.