{"comment":{"created_at":"2011-10-27T05:31:43Z","body":"看了一下代码, 中间结构使用JSON 那套比较好, 类型转换与注入可以做为 Castor 的一个子类来实现, 这样, 就可以直接调用 Castor.cast() 进行转换了.\r\n\r\nBTW: Castor 怎么翻译???英语差, 这个问题纠结了很多年了~~~今天终于逮着机会问题了...","updated_at":"2011-10-27T05:31:43Z","url":"https://api.github.com/repos/nutzam/nutz/issues/comments/2539886","id":2539886,"user":{"avatar_url":"https://secure.gravatar.com/avatar/0c540b67befb3df48d2e1f7b78b54c43?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"0c540b67befb3df48d2e1f7b78b54c43","url":"https://api.github.com/users/juqkai","id":436109,"login":"juqkai"}},"action":"created","issue":{"number":89,"created_at":"2011-10-27T01:27:05Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"总感觉 issues #30 那里的注入, 与 JSON 中的转换非常非常的相似...\r\n可不可以把这两个地方抽象一下呢? \r\n比如, 提取一个通用中间格式, 然后调用相同的注入方式生成对象. \r\n\r\nJSON 部分的中心思想是 \"将json理解为Map+List\", 也就是, 它将 String 的 JSON 转换成List, Map 的集合, 然后再遍历这个集合, 根据传入的类型进行转换.\r\n\r\n#30 (主要由 org.nutz.mvc.adaptor.injector.ObjcetNaviNode 类来做处理) 部分则是把字符串参数转换成一种树型的层资结构, 然后做遍历, 根据传入的类型进行转换...\r\n\r\n树型结构, 说白了, 也可以使用 Map<String, List<?>> 的形式来保存. 当然, List, Map也可以使用树型来保存. \r\n\r\n所以, 我觉得可以尝抽象一下, 然后调整一下相应生成中间结构的代码, 这样应该就可以了.\r\n\r\n不过, 这两种结构不知道怎么取舍会比较好? @ZOZOH @wendal给点意见呗\r\n","comments":1,"title":"对象注入的抽象","updated_at":"2011-10-27T05:31:43Z","url":"https://api.github.com/repos/nutzam/nutz/issues/89","id":2063710,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/0c540b67befb3df48d2e1f7b78b54c43?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"0c540b67befb3df48d2e1f7b78b54c43","url":"https://api.github.com/users/juqkai","id":436109,"login":"juqkai"},"html_url":"https://github.com/nutzam/nutz/issues/89","labels":[],"state":"open"},"legacy":{"issue_id":2063710,"comment_id":2539886}}