Skip to content

Instantly share code, notes, and snippets.

@wendal
Created September 5, 2012 13:44
Show Gist options
  • Save wendal/3636763 to your computer and use it in GitHub Desktop.
Save wendal/3636763 to your computer and use it in GitHub Desktop.
Nutz Json createBy用法示例
package org.nutz.json.meta;
import java.lang.reflect.Type;
import java.util.List;
import org.nutz.json.JsonField;
import org.nutz.lang.util.NutType;
import org.nutz.mapl.Mapl;
public class TreeNode {
private String name;
@JsonField(createBy="makeChildren")
private List<TreeNode> children;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<TreeNode> getChildren() {
return children;
}
public void setChildren(List<TreeNode> children) {
this.children = children;
}
public Object makeChildren(Type type, Object obj) {
return Mapl.maplistToObj(obj, NutType.list(getClass()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment