示例#1
0
    def gen_transform_code_java(self, node_name, field_name, trans_class_name,
                                trans_method_name, trans_arg_name, transform_ancestors,
                                pass_source):
        if not self.visitable or not transform_ancestors and self.ref_type != trans_class_name \
                or transform_ancestors and not is_subnode(trans_class_name, self.ref_type):
            return []

        transform_stmt_fmt = "{0}s({1}.get{2}(), {1}, {3});" if pass_source \
                             else "{0}s({1}.get{2}(), {3});"

        return [transform_stmt_fmt.format(trans_method_name, node_name, first_to_cap(field_name), trans_arg_name)]
示例#2
0
    def gen_transform_code_java(self, node_name, field_name, trans_class_name,
                                trans_method_name, trans_arg_name, transform_ancestors,
                                pass_source):
        if not self.visitable or not transform_ancestors and self.ref_type != trans_class_name \
                or transform_ancestors and not is_subnode(trans_class_name, self.ref_type):
            return []

        getter_name = "get" + first_to_cap(field_name)
        setter_name = "set" + first_to_cap(field_name)
        transform_stmt_fmt = "{0}.{1}({2}({0}.{3}, {0}, {4}));" if pass_source \
                             else "{0}.{1}({2}({0}.{3}(), {4}));"

        return [transform_stmt_fmt.format(node_name, setter_name, trans_method_name, getter_name, trans_arg_name)]