Jython相当于Java Code

时间:2012-09-26 06:13:31

标签: java python jython

我想将以下Java代码转换为Jython代码。我对Java知之甚少。

String name = connection.runReadAction(new ReadActionResult<String>()
{
     public String execute(SystemAccess access) throws Exception
     {
        return access.getTree(SystemTree.Geographic).resolve(path).getDisplayName();
     }
 });

你能帮我做这个任务吗?

1 个答案:

答案 0 :(得分:1)

def execute(access):
  return access.getTree(SystemTree.Geographic).resolve(path).getDisplayName()

name = connection.runReadAction(readActionResult=execute)

Jython处理创建匿名内部类的混乱细节。