use of org.ballerinalang.compiler.plugins.SupportEndpointTypes in project ballerina by ballerina-lang.
the class CompilerPluginRunner method handleEndpointProcesses.
private void handleEndpointProcesses(CompilerPlugin plugin) {
// Get the list of endpoint of that this particular compiler plugin is interested in.
SupportEndpointTypes supportEndpointTypes = plugin.getClass().getAnnotation(SupportEndpointTypes.class);
if (supportEndpointTypes == null) {
return;
}
final SupportEndpointTypes.EndpointType[] endpointTypes = supportEndpointTypes.value();
if (endpointTypes.length == 0) {
return;
}
DefinitionID[] definitions = Arrays.stream(endpointTypes).map(endpointType -> new DefinitionID(endpointType.packageName(), endpointType.name())).toArray(DefinitionID[]::new);
for (DefinitionID definitionID : definitions) {
if (isValidEndpoints(definitionID, plugin)) {
List<CompilerPlugin> processorList = endpointProcessorMap.computeIfAbsent(definitionID, k -> new ArrayList<>());
processorList.add(plugin);
}
}
}
Aggregations