If I have an instance of a component in java using...
# lucee
b
If I have an instance of a component in java using
lucee.runtime.Component
how do I access a variable set in the
variables
scope from inside of that CFC? I tried
get
but it is deprecated and will return null
d
You may want to provide a code example. I don't think there is any reasonable way that will allow you to access to the private scope of a java class.
b
@Brandon Brown To be clear you want to snag out the variables scope without modifying the actual CFC?
This can easily be done with a mixin injection
Copy code
function spy() {
  return variables;
}
c = new Component();
c.spy = spy;
dump( c.spy() )
and boom, you've dumped out the private variables scope of that CFC
When the spy method is added onto the CFC, it's reference to the
variables
scope will change to the variables scope of the CFC it now lives in.
Note, you must use a normal UDF as a closure will keep pointed to the
variables
scope of the location it was declared due to lexical scoping rules.