コード例 #1
0
ファイル: EventBeanUtility.cs プロジェクト: lanicon/nesper
        /// <summary>
        ///     Renders a map of elements, in which elements can be events or event arrays interspersed with other objects,
        /// </summary>
        /// <param name="map">to render</param>
        /// <returns>comma-separated list of map entry name-value pairs</returns>
        public static string ToString(IDictionary<string, object> map)
        {
            if (map == null) {
                return "null";
            }

            if (map.IsEmpty()) {
                return "";
            }

            var buf = new StringBuilder();
            var delimiter = "";
            foreach (var entry in map) {
                buf.Append(delimiter);
                buf.Append(entry.Key);
                buf.Append("=");
                if (entry.Value is EventBean) {
                    buf.Append(EventBeanSummarizer.Summarize((EventBean) entry.Value));
                }
                else if (entry.Value is EventBean[]) {
                    buf.Append(EventBeanSummarizer.Summarize((EventBean[]) entry.Value));
                }
                else if (entry.Value == null) {
                    buf.Append("null");
                }
                else {
                    buf.Append(entry.Value);
                }

                delimiter = ", ";
            }

            return buf.ToString();
        }
コード例 #2
0
 public void Render(EventBean theEvent, StringWriter writer)
 {
     EventBeanSummarizer.Summarize(theEvent, writer);
 }