@Override public StringBuilder visitDefinition_stream(@NotNull SiddhiQLParser.Definition_streamContext ctx) { StringBuilder streamText = new StringBuilder(" {\"Stream\": "); streamText.append(" [{ \"streamId\":\"").append(ctx.source().stream_id().getText()).append("\" ,"); String stream_Text = excapeCode(tokenStreamRewriter.getTokenStream().getText(ctx.getStart(), ctx.getStop())); streamText.append(" \"stream_Text\":\"").append(stream_Text).append("\" ,"); if (ctx.annotation().isEmpty()) { streamText.append(" \"annoName\": ").append("null").append(" ,"); streamText.append(" \"annoElement\": ").append("null").append(" ,"); } else { for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) { streamText.append(" \"annoName\":\"").append(annotationContext.name().getText()).append("\" ,"); if (annotationContext.annotation_element().isEmpty()) { streamText.append(" \"annoElement\": ").append("null").append(" ,"); } else { for (SiddhiQLParser.Annotation_elementContext elementContext : annotationContext.annotation_element()) { streamText.append(" \"annoElement\":\"").append(elementContext.property_value().getText()).append("\" ,"); } } } } streamText = new StringBuilder(streamText.substring(0, streamText.length() - 1)); streamText.append(" }]}"); return streamText; }