I was wondering what your thoughts/concerns are regarding to refering to a property itself in your getter/setter... Is this considered to be always save and correct in apex?
Example:
private String stringVar{
get{
if (stringVar == null){
stringVar = someValue;
}
return stringVar;
}
set{stringVar = value;}
}
This works perfectly in apex. Some programming languages however avoid this by refering to a field value in the getter and setter like this:
private String _stringVar;
private String stringVar{
get{
if (_stringVar == null){
_stringVar = someValue;
}
return _stringVar;
}
set{_stringVar = value;}
}