Created
September 5, 2012 13:44
-
-
Save wendal/3636763 to your computer and use it in GitHub Desktop.
Nutz Json createBy用法示例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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