Exemple #1
0
 public void addInnerClass(AFClassInfo innerClass)
 {
     if (innerClasses == null)
     {
         innerClasses = new List<AFClassInfo>();
     }
     innerClasses.Add(innerClass);
 }
        public AFClassInfo parse(String classInfoStr, bool parsingInnerClass)
        {
            AFClassInfo definition = null;

            try
            {
                JsonObject classInfo = JsonObject.Parse(classInfoStr);
                if (!parsingInnerClass)
                {
                    classInfo = (JsonObject) Utils.TryToGetValueFromJson(classInfo[(Constants.CLASS_INFO)]);
                }

                //Parse class name and create data pack with this class name
                Debug.WriteLine("PARSING CLASS " + Utils.TryToGetValueFromJson(classInfo[Constants.CLASS_NAME]));
                definition = new AFClassInfo((String) Utils.TryToGetValueFromJson(classInfo[Constants.CLASS_NAME]));

                //Parse layout
                JsonObject layout = (JsonObject) Utils.TryToGetValueFromJson(classInfo[Constants.LAYOUT]);
                definition.setLayout(createTopLayoutProperties(layout));

                //Parse fields
                JsonArray fields = (JsonArray) Utils.TryToGetValueFromJson(classInfo[Constants.FIELD_INFO]);
                if (fields != null)
                {
                    for (int i = 0; i < fields.Count; i++)
                    {
                        JsonObject field = fields[i].GetObject();
                        definition.addFieldInfo(parseFieldInfo(field));
                    }
                }
                JsonArray innerClasses = (JsonArray) Utils.TryToGetValueFromJson(classInfo[Constants.INNER_CLASSES]);
                if (innerClasses != null)
                {
                    for (int i = 0; i < innerClasses.Count; i++)
                    {
                        JsonObject innerClass = (JsonObject) Utils.TryToGetValueFromJson(innerClasses[i]);
                        definition.addInnerClass(parse(innerClass.Stringify(), true)); //recursion;
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.StackTrace);
            }

            return definition;
        }
Exemple #3
0
 public void setComponentInfo(AFClassInfo classInfo)
 {
     this.componentInfo = classInfo;
 }