io.kubernetes.client.fluent.VisitorWiretap Maven / Gradle / Ivy
/*
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.kubernetes.client.fluent;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public final class VisitorWiretap implements Visitor {
private VisitorWiretap(
io.kubernetes.client.fluent.Visitor delegate, Collection listeners) {
this.delegate = delegate;
this.listeners = listeners;
}
private final java.util.Collection listeners;
private final io.kubernetes.client.fluent.Visitor delegate;
public static VisitorWiretap create(
io.kubernetes.client.fluent.Visitor visitor,
java.util.Collection listeners) {
if (visitor instanceof VisitorWiretap) {
return (VisitorWiretap) visitor;
}
return new VisitorWiretap(visitor, listeners);
}
public Class getType() {
return delegate.getType();
}
public void visit(T target) {
listeners.forEach(l -> l.beforeVisit(delegate, Collections.emptyList(), target));
delegate.visit(target);
listeners.forEach(l -> l.afterVisit(delegate, Collections.emptyList(), target));
}
public int order() {
return delegate.order();
}
public void visit(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy