private void extractDetails(EndpointNode ep, AnnotationAttachmentNode ann) { this.name = ep.getName().getValue(); BLangRecordLiteral bLiteral = (BLangRecordLiteral) ep.getConfigurationExpression(); List<BLangRecordLiteral.BLangRecordKeyValue> list = bLiteral.getKeyValuePairs(); Map<String, String[]> configs = GeneratorUtils.getKeyValuePairAsMap(list);
packageNode.getGlobalEndpoints().forEach(endpoint -> strings.add(endpoint.getName().getValue())); packageNode.getServices().forEach(service -> strings.add(service.name.value)); packageNode.getFunctions().forEach(func -> strings.add(func.name.value));
/** * Build a parsable object model for a service endpoint. {@code ep} must be bound to the {@code service} * inorder to extract its details. If {@code ep} is not bound to the {@code service} null * will be returned * * @param service service with bound endpoints * @param ep {@link EndpointNode} which to extract details from * @return if {@code ep} is bound to the {@code service}, endpoint context will be returned. * otherwise empty null will be returned */ public static EndpointContextHolder buildContext(ServiceNode service, EndpointNode ep) { EndpointContextHolder endpoint = null; for (SimpleVariableReferenceNode node : service.getBoundEndpoints()) { if (node.getVariableName().equals(ep.getName())) { endpoint = new EndpointContextHolder(); AnnotationAttachmentNode ann = GeneratorUtils .getAnnotationFromList("ServiceConfig", GeneratorConstants.HTTP_PKG_ALIAS, service.getAnnotationAttachments()); endpoint.extractDetails(ep, ann); break; } } return endpoint; }