io.atlassian.util.adapter.javax.servlet.JavaXServletContextEventAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakarta-adapters Show documentation
Show all versions of jakarta-adapters Show documentation
A collection of classes for adapting Servlet API 4.0 objects to Servlet API 5.0 and vice versa.
package io.atlassian.util.adapter.javax.servlet;
import io.atlassian.util.adapter.jakarta.servlet.JakartaServletContextEventAdapter;
import javax.servlet.ServletContextEvent;
import static io.atlassian.util.adapter.javax.JavaXAdapters.asJavaX;
import static io.atlassian.util.adapter.util.WrapperUtil.applyIfNonNull;
import static java.util.Objects.requireNonNull;
public class JavaXServletContextEventAdapter extends ServletContextEvent {
private final jakarta.servlet.ServletContextEvent delegate;
public static ServletContextEvent from(jakarta.servlet.ServletContextEvent delegate) {
if (delegate instanceof JakartaServletContextEventAdapter castDelegate) {
return castDelegate.getDelegate();
}
return applyIfNonNull(delegate, JavaXServletContextEventAdapter::new);
}
JavaXServletContextEventAdapter(jakarta.servlet.ServletContextEvent delegate) {
super(asJavaX(requireNonNull(delegate).getServletContext()));
this.delegate = delegate;
}
public jakarta.servlet.ServletContextEvent getDelegate() {
return delegate;
}
}