java.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:sysl 作者: anz-bank 项目源码 文件源码
def ViewMethod(w, tname, visibility, out_tname, name, params=(), throws=(),
               override=False):
    view_tname = 'View' if tname == out_tname else out_tname + '.View'

    with Method(w, visibility, view_tname, name, params, throws,
                override):
        @contextlib.contextmanager
        def view():
            w('return new {}(model) {{', view_tname)
            with w.indent():
                @contextlib.contextmanager
                def enumerator_method(src_var=None):
                    with EnumeratorMethod(w, 'public', out_tname,
                                          source=src_var and (src_var, 'View.this', tname)) as enumerator:
                        yield enumerator

                yield enumerator_method

        yield view

        w('}};')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号