use of io.kubernetes.client.spring.extended.controller.annotation.AddWatchEventFilter in project java by kubernetes-client.
the class KubernetesControllerFactory method getAddFilters.
private Map<Class, AddFilterAdaptor> getAddFilters(KubernetesReconcilerWatches watches, Reconciler reconciler) {
Map<Class, AddFilterAdaptor> filters = new HashMap<>();
Set<Method> allAnnotatedMethods = new HashSet<>();
Set<Method> adoptedMethods = new HashSet<>();
for (KubernetesReconcilerWatch watch : watches.value()) {
for (Method method : reconciler.getClass().getMethods()) {
AddWatchEventFilter annotation = method.getAnnotation(AddWatchEventFilter.class);
if (annotation == null) {
continue;
}
if (watch.apiTypeClass().equals(annotation.apiTypeClass())) {
if (filters.containsKey(watch.apiTypeClass())) {
log.warn("Duplicated watch ADD event filter upon apiType {}", annotation.apiTypeClass());
}
filters.put(watch.apiTypeClass(), new AddFilterAdaptor(reconciler, method));
adoptedMethods.add(method);
}
allAnnotatedMethods.add(method);
}
}
allAnnotatedMethods.removeAll(adoptedMethods);
if (allAnnotatedMethods.size() > 0) {
log.warn("Dangling watch ADD event filters {}", StringUtils.join(allAnnotatedMethods, ","));
}
return filters;
}
Aggregations