예제 #1
0
        /// <summary>
        /// Copy constructor.<br>
        /// Initializes the components list with a deep copy of the source components list. </summary>
        /// <param name="source"> a field instance to copy
        /// @since 7.7 </param>
        public static Field14S newInstance(Field14S source)
        {
            Field14S cp = new Field14S();

            cp.Components = new List <>(source.Components);
            return(cp);
        }
예제 #2
0
        public static Field14S fromJson(string json)
        {
            Field14S   field      = new Field14S();
            JsonParser parser     = new JsonParser();
            JsonObject jsonObject = (JsonObject)parser.parse(json);

            if (jsonObject.get("source") != null)
            {
                field.Component1 = jsonObject.get("source").AsString;
            }
            if (jsonObject.get("number") != null)
            {
                field.setComponent2(jsonObject.get("number").AsString);
            }
            if (jsonObject.get("time") != null)
            {
                field.setComponent3(jsonObject.get("time").AsString);
            }
            if (jsonObject.get("location") != null)
            {
                field.Component4 = jsonObject.get("location").AsString;
            }
            return(field);
        }