Hi I want to convert a class’s all String field values to their uppercase format. How can I do this? Please help.
Example:
public class ConvertStringToUppercase{
private String field1; //to be converted Uppercase
private String field2; //to be converted Uppercase
private String field3; //to be converted Uppercase
...... //more fields
}
You can use reflection for a quick and dirty solution:
This is not a nice approach however, since private fields should not be modified this way.