Implicit Accessor Methods
Implicit Accessor Methods in Lucee allows treating getters and setter methods on a component as if they were public variables in the this scope. This enables the developer to gracefully wrap public variables in a function to validate them. To enable this feature, it requires an override in the Application.cfc
Consider the following component:
Normally, one would call the setter & getter methods, setMyValue()
and getMyValue()
, like the following:
However, it is possible to access the variables in the public this
scope, and Lucee will look for any setters & getters and call them instead, if they exist:
The above would output FOO