New ScreenPanel
This commit is contained in:
41
plugins/test/Final.java
Executable file
41
plugins/test/Final.java
Executable file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
package test;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
public class Final {
|
||||
public static class TestClass {
|
||||
protected void method1() {
|
||||
System.out.println("On protected");
|
||||
}
|
||||
final public void method2() {
|
||||
System.out.println("On final public");
|
||||
}
|
||||
final protected void method3() {
|
||||
System.out.println("On final protected");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");
|
||||
|
||||
engine.eval("import test.Final.TestClass");
|
||||
|
||||
engine.eval("class MyClass(test.Final.TestClass):\n"
|
||||
+ " def m1(self):\n"
|
||||
+ " self.method1()\n"
|
||||
+ " def m2(self):\n"
|
||||
+ " self.method2()\n"
|
||||
+ " def m3(self):\n"
|
||||
+ " self.method3()\n");
|
||||
engine.eval("o = MyClass()");
|
||||
|
||||
engine.eval("o.m1()");
|
||||
engine.eval("o.m2()");
|
||||
engine.eval("o.m3()");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user