I'm using Jython to write tests for a Java project. It works well, but I can't figure how to get access to a java public nested class.
package mypackage;
public class NyClass {
public class MyNestedClass {
...
}
}
Does somebody knows how to do this?
asked Oct 31, 2008 at 11:08
fulmicoton
16.1k10 gold badges56 silver badges74 bronze badges
1 Answer 1
I'm not entirely sure by what you mean by access, but if you after creating instances of the MyNestedClass it's no problem in jython.
In this case, since MyNestedClass is a non-static nested class every instance of it needs a reference to an instance of MyClass. To do this in jython:
import mypackage.MyClass
import mypackage.MyClass.MyNestedClass
outer = mypackage.MyClass()
inner = mypackage.MyClass.MyNestedClass(outer)
answered Oct 31, 2008 at 11:30
Filip Korling
6133 silver badges7 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-java