@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; }
public final AnnotationContext annotation() throws RecognitionException { AnnotationContext _localctx = new AnnotationContext(_ctx, getState()); enterRule(_localctx, 56, RULE_annotation); int _la;
@Override public StringBuilder visitQuery(@NotNull SiddhiQLParser.QueryContext ctx) { StringBuilder queryText = new StringBuilder(" { \"Query\": [{ "); if (ctx.annotation().isEmpty()) { queryText.append(" \"annotationElement\":\"").append("query").append("\","); } else { queryText.append("\"annotationElement\":\"").append(ctx.annotation().get(0).annotation_element().get(0).property_value().getText()).append("\","); } queryText.append("\"inputStream\":").append(visit(ctx.query_input())).append(","); if (ctx.query_section() != null) { queryText.append("\"selection\":\"").append(ctx.query_section().getText()).append("\","); } queryText.append("\"outputStream\":").append(visit(ctx.query_output())).append(","); String q_Text = excapeCode(tokenStreamRewriter.getTokenStream().getText(ctx.getStart(), ctx.getStop())); queryText.append("\"query_Text\":\"").append(q_Text).append("\","); queryText = new StringBuilder(queryText.substring(0, queryText.length() - 1)); queryText.append(" }]}"); return queryText; }
/** * {@inheritDoc} * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> * * @param ctx */ @Override public Annotation visitAnnotation(@NotNull SiddhiQLParser.AnnotationContext ctx) { Annotation annotation = Annotation.annotation((String) visit(ctx.name())); for (SiddhiQLParser.Annotation_elementContext elementContext : ctx.annotation_element()) { annotation.element((Element) visit(elementContext)); } for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) { annotation.annotation((Annotation) visit(annotationContext)); } populateQueryContext(annotation, ctx); return annotation; }
public List<Annotation_elementContext> annotation_element() { return getRuleContexts(Annotation_elementContext.class); } public AnnotationContext annotation(int i) {
public List<AnnotationContext> annotation() { return getRuleContexts(AnnotationContext.class); } public Annotation_elementContext annotation_element(int i) {
public NameContext name() { return getRuleContext(NameContext.class,0); } public AnnotationContext(ParserRuleContext parent, int invokingState) {
public AnnotationContext annotation(int i) { return getRuleContext(AnnotationContext.class,i); } public NameContext name() {
public Annotation_elementContext annotation_element(int i) { return getRuleContext(Annotation_elementContext.class,i); } public List<Annotation_elementContext> annotation_element() {