TreeElement.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:FusePort 作者:
@SuppressWarnings({ "unchecked"})
public TreeElement(String name, MemorySection section)
{
    this.name = name;

    Map<String, Object> kids = section.getValues(false);

    for(Entry<String, Object> element : kids.entrySet())
    {
        String key = element.getKey();
        Object obj = element.getValue();

        if(obj instanceof MemorySection)
        {
            childreen.put(key, new TreeElement<T>(key, (MemorySection) obj));
        }
        else 
        {
            try
            {
                T castedValue = (T) obj;
                if("data".equals(key))
                {
                    value = castedValue;
                }
                else if(value == null)
                {
                    value = castedValue;
                }
            }
            catch(ClassCastException e)
            {
                //Ignore its the wrong type
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号