private static Annotation updateAnnotationRef(Annotation annotation, String type,
                                                  SiddhiAppContext siddhiAppContext) {
        String ref = annotation.getElement(SiddhiConstants.ANNOTATION_ELEMENT_REF);
        if (ref != null) {
            Map<String, String> systemConfigs = siddhiAppContext.getSiddhiContext().getConfigManager()
                    .extractSystemConfigs(ref);

            if (systemConfigs.size() == 0) {
                throw new SiddhiAppCreationException("The " + type + " element of the name '" + ref +
                        "' is not defined in the configurations file.",
                        annotation.getQueryContextStartIndex(),
                        annotation.getQueryContextEndIndex());
            } else {
                HashMap<String, String> newSystemConfig = new HashMap<>(systemConfigs);

                Map<String, String> collection = annotation.getElements().stream()
                        .collect(Collectors.toMap(Element::getKey, Element::getValue));
                collection.remove(SiddhiConstants.ANNOTATION_ELEMENT_REF);
                newSystemConfig.putAll(collection);

                List<Element> annotationElements = newSystemConfig.entrySet().stream()
                        .map((property) -> new Element(
                                property.getKey(),
                                property.getValue()))
                        .collect(Collectors.toList());

                annotation.setElements(annotationElements);
            }
        }
        return annotation;
    }
Utility class for queryParser to help with QueryRuntime
generation.
modules/siddhi-core/src/main/java/io/siddhi/core/util/parser/helper/DefinitionParserHelper.java