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