Exemplo n.º 1
0
            public void Render(EventPropertyRendererContext context)
            {
                if (context.PropertyName.Equals("SomeProperties")) {
                    var value = (object[]) context.PropertyValue;

                    var builder = context.StringBuilder;
                    if (context.IsJsonFormatted) {
                        context.StringBuilder.Append("\"");
                    }

                    var delimiter = "";
                    for (var i = 0; i < value.Length; i++) {
                        builder.Append(delimiter);
                        builder.Append("index#");
                        builder.Append(Convert.ToString(i));
                        builder.Append("=");
                        builder.Append(value[i]);
                        delimiter = ";";
                    }

                    if (context.IsJsonFormatted) {
                        context.StringBuilder.Append("\"");
                    }
                }
                else {
                    context.DefaultRenderer.Render(context.PropertyValue, context.StringBuilder);
                }

                Contexts.Add(context.Copy());
            }
Exemplo n.º 2
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="preventLooping">true to prevent looping</param>
 /// <param name="isXmlOutput">true for XML output</param>
 /// <param name="renderer">The renderer.</param>
 /// <param name="rendererContext">The renderer context.</param>
 public RendererMetaOptions(bool preventLooping,
                            bool isXmlOutput,
                            EventPropertyRenderer renderer,
                            EventPropertyRendererContext rendererContext)
 {
     PreventLooping  = preventLooping;
     IsXmlOutput     = isXmlOutput;
     Renderer        = renderer;
     RendererContext = rendererContext;
 }
Exemplo n.º 3
0
 public void Render(EventPropertyRendererContext context)
 {
     if (context.PropertyValue is object[])
     {
         context.StringBuilder.Append(CompatExtensions.RenderAny((object[]) context.PropertyValue));
     }
     else
     {
         context.DefaultRenderer.Render(context.PropertyValue, context.StringBuilder);
     }
 }
Exemplo n.º 4
0
        /// <summary>Ctor. </summary>
        /// <param name="eventType">type of Event(s)</param>
        /// <param name="options">rendering options</param>
        public JSONRendererImpl(EventType eventType, JSONRenderingOptions options)
        {
            EventPropertyRenderer propertyRenderer = null;
            EventPropertyRendererContext propertyRendererContext = null;
            if (options.Renderer != null)
            {
                propertyRenderer = options.Renderer;
                propertyRendererContext = new EventPropertyRendererContext(eventType, true);
            }

            _rendererOptions = new RendererMetaOptions(options.PreventLooping, false, propertyRenderer, propertyRendererContext);
            _meta = new RendererMeta(eventType, new Stack<EventTypePropertyPair>(), _rendererOptions);
        }
Exemplo n.º 5
0
        public void TestPropertyCustomRenderer()
        {
            _epService.EPAdministrator.Configuration.AddEventType(
                typeof(MyRendererEvent));

            EPStatement stmt = _epService.EPAdministrator.CreateEPL(
                "select * from MyRendererEvent");

            _epService.EPRuntime.SendEvent(
                new MyRendererEvent("id1", new Object[][]
            {
                new Object[] { 1, "x" },
                new Object[] { 2, "y" }
            }));

            MyRenderer.Contexts.Clear();
            var jsonOptions = new JSONRenderingOptions();

            jsonOptions.Renderer = new MyRenderer();
            String json = _epService.EPRuntime.EventRenderer.RenderJSON(
                "MyEvent", stmt.First(), jsonOptions);

            Assert.AreEqual(4, MyRenderer.Contexts.Count);
            List <EventPropertyRendererContext> contexts = MyRenderer.Contexts;
            EventPropertyRendererContext        context  = contexts[2];

            Assert.NotNull(context.DefaultRenderer);
            Assert.AreEqual(1, (int)context.IndexedPropertyIndex);
            Assert.AreEqual(typeof(MyRendererEvent).Name, context.EventType.Name);
            Assert.AreEqual("SomeProperties", context.PropertyName);

            String expectedJson =
                "{ \"MyEvent\": { \"Id\": \"id1\", \"SomeProperties\": [\"index#0=1;index#1=x\", \"index#0=2;index#1=y\"], \"MappedProperty\": { \"key\": \"value\" } } }";

            Assert.AreEqual(RemoveNewline(expectedJson), RemoveNewline(json));

            MyRenderer.Contexts.Clear();
            var xmlOptions = new XMLRenderingOptions();

            xmlOptions.Renderer = new MyRenderer();
            String xmlOne = _epService.EPRuntime.EventRenderer.RenderXML(
                "MyEvent", stmt.First(), xmlOptions);
            String expected =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <MyEvent> <Id>id1</Id> <SomeProperties>index#0=1;index#1=x</SomeProperties> <SomeProperties>index#0=2;index#1=y</SomeProperties> <MappedProperty> <key>value<key> </MappedProperty> </MyEvent>";

            Assert.AreEqual(4, MyRenderer.Contexts.Count);
            Assert.AreEqual(RemoveNewline(expected), RemoveNewline(xmlOne));
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Ctor.
        /// </summary>
        /// <param name="eventType">type of event to render</param>
        /// <param name="options">rendering options</param>
        public XMLRendererImpl(
            EventType eventType,
            XMLRenderingOptions options)
        {
            EventPropertyRenderer propertyRenderer = null;
            EventPropertyRendererContext propertyRendererContext = null;
            if (options.Renderer != null) {
                propertyRenderer = options.Renderer;
                propertyRendererContext = new EventPropertyRendererContext(eventType, false);
            }

            rendererMetaOptions = new RendererMetaOptions(
                options.PreventLooping,
                true,
                propertyRenderer,
                propertyRendererContext);
            meta = new RendererMeta(eventType, new Stack<EventTypePropertyPair>(), rendererMetaOptions);
            this.options = options;
        }
Exemplo n.º 7
0
        private static void RecursiveRender(EventBean theEvent, StringBuilder buf, int level, RendererMeta meta,
                                            RendererMetaOptions rendererMetaOptions)
        {
            GetterPair[] simpleProps = meta.SimpleProperties;
            foreach (GetterPair simpleProp in simpleProps.OrderBy(prop => prop.Name))
            {
                var value = simpleProp.Getter.Get(theEvent);
                if (value == null)
                {
                    continue;
                }

                Ident(buf, level);
                buf.Append('<');
                buf.Append(simpleProp.Name);
                buf.Append('>');

                if (rendererMetaOptions.Renderer == null)
                {
                    simpleProp.Output.Render(value, buf);
                }
                else
                {
                    EventPropertyRendererContext context = rendererMetaOptions.RendererContext;
                    context.SetStringBuilderAndReset(buf);
                    context.PropertyName    = simpleProp.Name;
                    context.PropertyValue   = value;
                    context.DefaultRenderer = simpleProp.Output;
                    rendererMetaOptions.Renderer.Render(context);
                }

                buf.Append("</");
                buf.Append(simpleProp.Name);
                buf.Append('>');
                buf.Append(NEWLINE);
            }

            GetterPair[] indexProps = meta.IndexProperties;
            foreach (GetterPair indexProp in indexProps.OrderBy(prop => prop.Name))
            {
                object value = indexProp.Getter.Get(theEvent);

                if (value == null)
                {
                    continue;
                }

                if (value is string)
                {
                    Ident(buf, level);

                    buf.Append('<');
                    buf.Append(indexProp.Name);
                    buf.Append('>');

                    if (rendererMetaOptions.Renderer == null)
                    {
                        indexProp.Output.Render(value, buf);
                    }
                    else
                    {
                        EventPropertyRendererContext context = rendererMetaOptions.RendererContext;
                        context.SetStringBuilderAndReset(buf);
                        context.PropertyName    = indexProp.Name;
                        context.PropertyValue   = value;
                        context.DefaultRenderer = indexProp.Output;
                        rendererMetaOptions.Renderer.Render(context);
                    }

                    buf.Append("</");
                    buf.Append(indexProp.Name);
                    buf.Append('>');
                    buf.Append(NEWLINE);

                    continue;
                }

                var asArray = value as Array;
                if (asArray == null)
                {
                    Log.Warn("Property '" + indexProp.Name + "' returned a non-array object");
                    continue;
                }

                for (int i = 0; i < asArray.Length; i++)
                {
                    object arrayItem = asArray.GetValue(i);

                    if (arrayItem == null)
                    {
                        continue;
                    }

                    Ident(buf, level);
                    buf.Append('<');
                    buf.Append(indexProp.Name);
                    buf.Append('>');

                    if (rendererMetaOptions.Renderer == null)
                    {
                        indexProp.Output.Render(arrayItem, buf);
                    }
                    else
                    {
                        EventPropertyRendererContext context = rendererMetaOptions.RendererContext;
                        context.SetStringBuilderAndReset(buf);
                        context.PropertyName         = indexProp.Name;
                        context.PropertyValue        = arrayItem;
                        context.IndexedPropertyIndex = i;
                        context.DefaultRenderer      = indexProp.Output;
                        rendererMetaOptions.Renderer.Render(context);
                    }

                    buf.Append("</");
                    buf.Append(indexProp.Name);
                    buf.Append('>');
                    buf.Append(NEWLINE);
                }
            }

            GetterPair[] mappedProps = meta.MappedProperties;
            foreach (GetterPair mappedProp in mappedProps.OrderBy(prop => prop.Name))
            {
                object value = mappedProp.Getter.Get(theEvent);

                if ((value != null) && (!(value is DataMap)))
                {
                    Log.Warn("Property '" + mappedProp.Name + "' expected to return Map and returned " + value.GetType() +
                             " instead");
                    continue;
                }

                Ident(buf, level);
                buf.Append('<');
                buf.Append(mappedProp.Name);
                buf.Append('>');
                buf.Append(NEWLINE);

                if (value != null)
                {
                    var map = (DataMap)value;
                    if (map.IsNotEmpty())
                    {
                        String localDelimiter = "";
                        foreach (var entry in map)
                        {
                            if (entry.Key == null)
                            {
                                continue;
                            }

                            buf.Append(localDelimiter);
                            Ident(buf, level + 1);
                            buf.Append('<');
                            buf.Append(entry.Key);
                            buf.Append('>');

                            if (entry.Value != null)
                            {
                                OutputValueRenderer outputValueRenderer = OutputValueRendererFactory.GetOutputValueRenderer(
                                    entry.Value.GetType(), rendererMetaOptions);
                                if (rendererMetaOptions.Renderer == null)
                                {
                                    outputValueRenderer.Render(entry.Value, buf);
                                }
                                else
                                {
                                    EventPropertyRendererContext context = rendererMetaOptions.RendererContext;
                                    context.SetStringBuilderAndReset(buf);
                                    context.PropertyName      = mappedProp.Name;
                                    context.PropertyValue     = entry.Value;
                                    context.MappedPropertyKey = entry.Key;
                                    context.DefaultRenderer   = outputValueRenderer;
                                    rendererMetaOptions.Renderer.Render(context);
                                }
                            }

                            buf.Append('<');
                            buf.Append(entry.Key);
                            buf.Append('>');
                            localDelimiter = NEWLINE;
                        }
                    }
                }

                buf.Append(NEWLINE);
                Ident(buf, level);
                buf.Append("</");
                buf.Append(mappedProp.Name);
                buf.Append('>');
                buf.Append(NEWLINE);
            }

            var nestedProps = meta.NestedProperties;

            foreach (NestedGetterPair nestedProp in nestedProps.OrderBy(prop => prop.Name))
            {
                var value = nestedProp.Getter.GetFragment(theEvent);
                if (value == null)
                {
                    continue;
                }

                if (!nestedProp.IsArray)
                {
                    if (!(value is EventBean))
                    {
                        Log.Warn("Property '" + nestedProp.Name + "' expected to return EventBean and returned " +
                                 value.GetType() + " instead");
                        buf.Append("null");
                        continue;
                    }
                    RenderElementFragment((EventBean)value, buf, level, nestedProp, rendererMetaOptions);
                }
                else
                {
                    if (!(value is EventBean[]))
                    {
                        Log.Warn("Property '" + nestedProp.Name + "' expected to return EventBean[] and returned " +
                                 value.GetType() + " instead");
                        buf.Append("null");
                        continue;
                    }

                    var nestedEventArray = (EventBean[])value;
                    for (int i = 0; i < nestedEventArray.Length; i++)
                    {
                        EventBean arrayItem = nestedEventArray[i];
                        if (arrayItem == null)
                        {
                            continue;
                        }
                        RenderElementFragment(arrayItem, buf, level, nestedProp, rendererMetaOptions);
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void RenderAttributes(EventBean theEvent, StringBuilder buf, RendererMeta meta)
        {
            const string delimiter = " ";

            GetterPair[] simpleProps = meta.SimpleProperties;
            foreach (GetterPair simpleProp in simpleProps.OrderBy(prop => prop.Name))
            {
                var value = simpleProp.Getter.Get(theEvent);
                if (value == null)
                {
                    continue;
                }

                buf.Append(delimiter);
                buf.Append(simpleProp.Name);
                buf.Append("=\"");

                if (_rendererMetaOptions.Renderer == null)
                {
                    simpleProp.Output.Render(value, buf);
                }
                else
                {
                    EventPropertyRendererContext context = _rendererMetaOptions.RendererContext;
                    context.SetStringBuilderAndReset(buf);
                    context.PropertyName    = simpleProp.Name;
                    context.PropertyValue   = value;
                    context.DefaultRenderer = simpleProp.Output;
                    _rendererMetaOptions.Renderer.Render(context);
                }

                buf.Append('"');
            }

            GetterPair[] indexProps = meta.IndexProperties;
            foreach (GetterPair indexProp in indexProps.OrderBy(prop => prop.Name))
            {
                var value = indexProp.Getter.Get(theEvent);
                if (value == null)
                {
                    continue;
                }

                var asString = value as string;
                if (asString != null)
                {
                    buf.Append(delimiter);
                    buf.Append(indexProp.Name);
                    buf.Append("=\"");

                    if (_rendererMetaOptions.Renderer == null)
                    {
                        indexProp.Output.Render(value, buf);
                    }
                    else
                    {
                        EventPropertyRendererContext context = _rendererMetaOptions.RendererContext;
                        context.SetStringBuilderAndReset(buf);
                        context.PropertyName    = indexProp.Name;
                        context.PropertyValue   = value;
                        context.DefaultRenderer = indexProp.Output;
                        _rendererMetaOptions.Renderer.Render(context);
                    }

                    buf.Append('"');
                }
            }
        }
Exemplo n.º 9
0
        private String RenderAttElements(EventBean theEvent, int level, RendererMeta meta)
        {
            var buf = new StringBuilder();

            GetterPair[] indexProps = meta.IndexProperties;
            foreach (GetterPair indexProp in indexProps.OrderBy(prop => prop.Name))
            {
                var value = indexProp.Getter.Get(theEvent);
                if (value == null)
                {
                    continue;
                }

                if (value is string)
                {
                    continue;
                }

                var asArray = value as Array;
                if (asArray == null)
                {
                    Log.Warn("Property '" + indexProp.Name + "' returned a non-array object");
                    continue;
                }

                for (int i = 0; i < asArray.Length; i++)
                {
                    object arrayItem = asArray.GetValue(i);
                    if (arrayItem == null)
                    {
                        continue;
                    }

                    Ident(buf, level);
                    buf.Append('<');
                    buf.Append(indexProp.Name);
                    buf.Append('>');

                    if (_rendererMetaOptions.Renderer == null)
                    {
                        indexProp.Output.Render(arrayItem, buf);
                    }
                    else
                    {
                        EventPropertyRendererContext context = _rendererMetaOptions.RendererContext;
                        context.SetStringBuilderAndReset(buf);
                        context.PropertyName         = indexProp.Name;
                        context.PropertyValue        = arrayItem;
                        context.IndexedPropertyIndex = i;
                        context.DefaultRenderer      = indexProp.Output;
                        _rendererMetaOptions.Renderer.Render(context);
                    }

                    buf.Append("</");
                    buf.Append(indexProp.Name);
                    buf.Append('>');
                    buf.Append(NEWLINE);
                }
            }

            GetterPair[] mappedProps = meta.MappedProperties;
            foreach (GetterPair mappedProp in mappedProps.OrderBy(prop => prop.Name))
            {
                object value = mappedProp.Getter.Get(theEvent);

                if ((value != null) && (!(value is DataMap)))
                {
                    Log.Warn("Property '" + mappedProp.Name + "' expected to return Map and returned " + value.GetType() +
                             " instead");
                    continue;
                }

                Ident(buf, level);
                buf.Append('<');
                buf.Append(mappedProp.Name);

                if (value != null)
                {
                    var map = (DataMap)value;
                    if (map.IsNotEmpty())
                    {
                        foreach (var entry in map)
                        {
                            if ((entry.Key == null) || (entry.Value == null))
                            {
                                continue;
                            }

                            buf.Append(" ");
                            buf.Append(entry.Key);
                            buf.Append("=\"");

                            OutputValueRenderer outputValueRenderer =
                                OutputValueRendererFactory.GetOutputValueRenderer(entry.Value.GetType(), _rendererMetaOptions);

                            if (_rendererMetaOptions.Renderer == null)
                            {
                                outputValueRenderer.Render(entry.Value, buf);
                            }
                            else
                            {
                                EventPropertyRendererContext context = _rendererMetaOptions.RendererContext;
                                context.SetStringBuilderAndReset(buf);
                                context.PropertyName      = mappedProp.Name;
                                context.PropertyValue     = entry.Value;
                                context.MappedPropertyKey = entry.Key;
                                context.DefaultRenderer   = outputValueRenderer;
                                _rendererMetaOptions.Renderer.Render(context);
                            }

                            buf.Append("\"");
                        }
                    }
                }

                buf.Append("/>");
                buf.Append(NEWLINE);
            }

            NestedGetterPair[] nestedProps = meta.NestedProperties;
            foreach (NestedGetterPair nestedProp in nestedProps.OrderBy(prop => prop.Name))
            {
                object value = nestedProp.Getter.GetFragment(theEvent);

                if (value == null)
                {
                    continue;
                }

                if (!nestedProp.IsArray)
                {
                    if (!(value is EventBean))
                    {
                        Log.Warn("Property '" + nestedProp.Name + "' expected to return EventBean and returned " +
                                 value.GetType() + " instead");
                        buf.Append("null");
                        continue;
                    }
                    var nestedEventBean = (EventBean)value;
                    RenderAttInner(buf, level, nestedEventBean, nestedProp);
                }
                else
                {
                    if (!(value is EventBean[]))
                    {
                        Log.Warn("Property '" + nestedProp.Name + "' expected to return EventBean[] and returned " +
                                 value.GetType() + " instead");
                        buf.Append("null");
                        continue;
                    }

                    var nestedEventArray = (EventBean[])value;
                    for (int i = 0; i < nestedEventArray.Length; i++)
                    {
                        EventBean arrayItem = nestedEventArray[i];
                        RenderAttInner(buf, level, arrayItem, nestedProp);
                    }
                }
            }

            return(buf.ToString());
        }
Exemplo n.º 10
0
 public void Render(EventPropertyRendererContext context)
 {
 }
Exemplo n.º 11
0
        private static void RecursiveRender(EventBean theEvent, StringBuilder buf, int level, RendererMeta meta, RendererMetaOptions rendererOptions)
        {
            String delimiter = "";

            // simple properties
            GetterPair[] simpleProps = meta.SimpleProperties;
            if (rendererOptions.Renderer == null)
            {
                foreach (GetterPair simpleProp in simpleProps.OrderBy(prop => prop.Name))
                {
                    Object value = simpleProp.Getter.Get(theEvent);
                    WriteDelimitedIndentedProp(buf, delimiter, level, simpleProp.Name);
                    simpleProp.Output.Render(value, buf);
                    delimiter = COMMA_DELIMITER_NEWLINE;
                }
            }
            else
            {
                EventPropertyRendererContext context = rendererOptions.RendererContext;
                context.SetStringBuilderAndReset(buf);
                foreach (GetterPair simpleProp in simpleProps.OrderBy(prop => prop.Name))
                {
                    Object value = simpleProp.Getter.Get(theEvent);
                    WriteDelimitedIndentedProp(buf, delimiter, level, simpleProp.Name);
                    context.DefaultRenderer = simpleProp.Output;
                    context.PropertyName    = simpleProp.Name;
                    context.PropertyValue   = value;
                    rendererOptions.Renderer.Render(context);
                    delimiter = COMMA_DELIMITER_NEWLINE;
                }
            }

            GetterPair[] indexProps = meta.IndexProperties;
            foreach (GetterPair indexProp in indexProps.OrderBy(prop => prop.Name))
            {
                WriteDelimitedIndentedProp(buf, delimiter, level, indexProp.Name);

                var value = indexProp.Getter.Get(theEvent);
                if (value == null)
                {
                    buf.Append("null");
                }
                else if (value is string)
                {
                    if (rendererOptions.Renderer == null)
                    {
                        indexProp.Output.Render(value, buf);
                    }
                    else
                    {
                        EventPropertyRendererContext context = rendererOptions.RendererContext;
                        context.SetStringBuilderAndReset(buf);
                        context.DefaultRenderer = indexProp.Output;
                        context.PropertyName    = indexProp.Name;
                        context.PropertyValue   = value;
                        rendererOptions.Renderer.Render(context);
                    }
                }
                else
                {
                    var asArray = value as Array;
                    if (asArray == null)
                    {
                        buf.Append("[]");
                    }
                    else
                    {
                        buf.Append('[');

                        var arrayDelimiter = "";

                        if (rendererOptions.Renderer == null)
                        {
                            for (int i = 0; i < asArray.Length; i++)
                            {
                                var arrayItem = asArray.GetValue(i);
                                buf.Append(arrayDelimiter);
                                indexProp.Output.Render(arrayItem, buf);
                                arrayDelimiter = ", ";
                            }
                        }
                        else
                        {
                            EventPropertyRendererContext context = rendererOptions.RendererContext;
                            context.SetStringBuilderAndReset(buf);
                            for (int i = 0; i < asArray.Length; i++)
                            {
                                Object arrayItem = asArray.GetValue(i);
                                buf.Append(arrayDelimiter);
                                context.PropertyName         = indexProp.Name;
                                context.PropertyValue        = arrayItem;
                                context.IndexedPropertyIndex = i;
                                context.DefaultRenderer      = indexProp.Output;
                                rendererOptions.Renderer.Render(context);
                                arrayDelimiter = ", ";
                            }
                        }
                        buf.Append(']');
                    }
                }
                delimiter = COMMA_DELIMITER_NEWLINE;
            }

            GetterPair[] mappedProps = meta.MappedProperties;
            foreach (GetterPair mappedProp in mappedProps.OrderBy(prop => prop.Name))
            {
                var value = mappedProp.Getter.Get(theEvent);

                if ((value != null) && (!(value.GetType().IsGenericStringDictionary())))
                {
                    Log.Warn("Property '" + mappedProp.Name + "' expected to return Map and returned " + value.GetType() + " instead");
                    continue;
                }

                WriteDelimitedIndentedProp(buf, delimiter, level, mappedProp.Name);

                if (value == null)
                {
                    buf.Append("null");
                    buf.Append(NEWLINE);
                }
                else
                {
                    var map = MagicMarker.GetStringDictionary(value);
                    if (map.IsEmpty())
                    {
                        buf.Append("{}");
                        buf.Append(NEWLINE);
                    }
                    else
                    {
                        buf.Append('{');
                        buf.Append(NEWLINE);

                        var localDelimiter = "";
                        foreach (var entry in map)
                        {
                            if (entry.Key == null)
                            {
                                continue;
                            }

                            buf.Append(localDelimiter);
                            Ident(buf, level + 1);
                            buf.Append('\"');
                            buf.Append(entry.Key);
                            buf.Append("\": ");

                            if (entry.Value == null)
                            {
                                buf.Append("null");
                            }
                            else
                            {
                                OutputValueRenderer outRenderer = OutputValueRendererFactory.GetOutputValueRenderer(entry.Value.GetType(), rendererOptions);
                                if (rendererOptions.Renderer == null)
                                {
                                    outRenderer.Render(entry.Value, buf);
                                }
                                else
                                {
                                    EventPropertyRendererContext context = rendererOptions.RendererContext;
                                    context.SetStringBuilderAndReset(buf);
                                    context.PropertyName      = mappedProp.Name;
                                    context.PropertyValue     = entry.Value;
                                    context.MappedPropertyKey = entry.Key;
                                    context.DefaultRenderer   = outRenderer;
                                    rendererOptions.Renderer.Render(context);
                                }
                            }
                            localDelimiter = COMMA_DELIMITER_NEWLINE;
                        }

                        buf.Append(NEWLINE);
                        Ident(buf, level);
                        buf.Append('}');
                    }
                }

                delimiter = COMMA_DELIMITER_NEWLINE;
            }

            NestedGetterPair[] nestedProps = meta.NestedProperties;
            foreach (NestedGetterPair nestedProp in nestedProps.OrderBy(prop => prop.Name))
            {
                var value = nestedProp.Getter.GetFragment(theEvent);

                WriteDelimitedIndentedProp(buf, delimiter, level, nestedProp.Name);

                if (value == null)
                {
                    buf.Append("null");
                }
                else if (!nestedProp.IsArray)
                {
                    if (!(value is EventBean))
                    {
                        Log.Warn("Property '" + nestedProp.Name + "' expected to return EventBean and returned " + value.GetType() + " instead");
                        buf.Append("null");
                        continue;
                    }
                    var nestedEventBean = (EventBean)value;
                    buf.Append('{');
                    buf.Append(NEWLINE);

                    RecursiveRender(nestedEventBean, buf, level + 1, nestedProp.Metadata, rendererOptions);

                    Ident(buf, level);
                    buf.Append('}');
                }
                else
                {
                    if (!(value is EventBean[]))
                    {
                        Log.Warn("Property '" + nestedProp.Name + "' expected to return EventBean[] and returned " + value.GetType() + " instead");
                        buf.Append("null");
                        continue;
                    }


                    StringBuilder arrayDelimiterBuf = new StringBuilder();
                    arrayDelimiterBuf.Append(',');
                    arrayDelimiterBuf.Append(NEWLINE);
                    Ident(arrayDelimiterBuf, level + 1);

                    EventBean[] nestedEventArray = (EventBean[])value;
                    String      arrayDelimiter   = "";
                    buf.Append('[');

                    for (int i = 0; i < nestedEventArray.Length; i++)
                    {
                        EventBean arrayItem = nestedEventArray[i];
                        buf.Append(arrayDelimiter);
                        arrayDelimiter = arrayDelimiterBuf.ToString();

                        buf.Append('{');
                        buf.Append(NEWLINE);

                        RecursiveRender(arrayItem, buf, level + 2, nestedProp.Metadata, rendererOptions);

                        Ident(buf, level + 1);
                        buf.Append('}');
                    }
                    buf.Append(']');
                }
                delimiter = COMMA_DELIMITER_NEWLINE;
            }

            buf.Append(NEWLINE);
        }