Skip to content

Commit aff24d2

Browse files
Add C2C support for the ai listener
1 parent f6256f0 commit aff24d2

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

cloud-util/src/main/java/io/ballerina/c2c/util/C2CVisitor.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import java.util.Map;
6868
import java.util.Objects;
6969
import java.util.Optional;
70+
import java.util.Set;
7071

7172
/**
7273
* Visitor for validation related to code to cloud.
@@ -77,6 +78,9 @@
7778
@Data
7879
public class C2CVisitor extends NodeVisitor {
7980

81+
private static final Set<String> C2C_SUPPORTED_LISTENERS = Set.of("http", "grpc", "graphql", "tcp", "udp",
82+
"websocket", "websub", "websubhub", "ai");
83+
8084
private final List<ServiceInfo> services = new ArrayList<>();
8185
private final Map<String, Node> moduleLevelVariables;
8286
private final SemanticModel semanticModel;
@@ -454,20 +458,7 @@ private boolean isC2CNativelySupportedListener(TypeSymbol typeSymbol) {
454458
return false;
455459
}
456460
String moduleName = module.get().getName().get();
457-
switch (moduleName) {
458-
case "http":
459-
case "grpc":
460-
case "graphql":
461-
case "tcp":
462-
case "udp":
463-
case "websocket":
464-
case "websub":
465-
case "websubhub":
466-
//TODO add other stdlib
467-
return true;
468-
default:
469-
return false;
470-
}
461+
return C2C_SUPPORTED_LISTENERS.contains(moduleName);
471462
}
472463
return false;
473464
}

0 commit comments

Comments
 (0)