![]() Home | ![]() Back | ![]() Contents | ![]() Next |
Note: If you print a 'this' type reference you'll see what it refers to: BeanShell 1.3 - by Pat Niemeyer (pat@pat.net) bsh % print( this ); 'this' reference (XThis) to Bsh object: global bsh % foo() { print(this); print(super); } bsh % foo(); 'this' reference (XThis) to Bsh object: foo 'this' reference (XThis) to Bsh object: global |
super.super.super...foo = 42; // Chain super. to reach the top |
global.foo = 42; |
// Create a global object to hold some state dataholder = object(); foo() { ... bar() { dataholder.value = 42; } bar(); print( dataholder.value ); } |
Tip: In the above example we used the BeanShell object() command to create an "empty" BeanShell scripted object context in which to hold some data. (The object() command is just a standard empty method named object() that returns 'this'.) |
![]() Home | ![]() Back | ![]() Contents | ![]() Next |