Is it bad practice to change my getter method like version 2 in my class.
Version 1:
public String getMyValue(){ return this.myValue }
You can use some value holder for this purpose. Like Optional class in guava library.