WXDomObject.java 文件源码

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

项目:weex-uikit 作者:
/**
 * Parse the jsonObject to {@link WXDomObject} recursively
 * @param map the original JSONObject
 */
public void parseFromJson(JSONObject map){
  if (map == null || map.size() <= 0) {
    return;
  }

  String type = (String) map.get("type");
  this.mType = type;
  this.mRef = (String) map.get("ref");
  Object style = map.get("style");
  if (style != null && style instanceof JSONObject) {
    WXStyle styles = new WXStyle();
    styles.putAll((JSONObject) style,false);
    this.mStyles = styles;
  }
  Object attr = map.get("attr");
  if (attr != null && attr instanceof JSONObject) {
    WXAttr attrs = new WXAttr((JSONObject) attr);
    //WXJsonUtils.putAll(attrs, (JSONObject) attr);
    this.mAttributes = attrs;
  }
  Object event = map.get("event");
  if (event != null && event instanceof JSONArray) {
    WXEvent events = new WXEvent();
    JSONArray eventArray = (JSONArray) event;
    int count = eventArray.size();
    for (int i = 0; i < count; ++i) {
      events.add(eventArray.getString(i));
    }
    this.mEvents = events;
  }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号