org.zalando.logbook.BodyReplacer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logbook-api Show documentation
Show all versions of logbook-api Show documentation
HTTP request and response logging
package org.zalando.logbook;
import org.apiguardian.api.API;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Objects;
import static org.apiguardian.api.API.Status.STABLE;
@API(status = STABLE)
@FunctionalInterface
public interface BodyReplacer {
@Nullable
String replace(final T message);
@SafeVarargs
static BodyReplacer composite(final BodyReplacer... replacers) {
// TODO shouldn't this be a composite rather than first one wins?
return message -> Arrays.stream(replacers)
.map(replacer -> replacer.replace(message))
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy