io.atlassian.util.adapter.javax.el.JavaXImportHandlerAdapter 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.el;
import io.atlassian.util.adapter.jakarta.el.JakartaImportHandlerAdapter;
import javax.el.ELException;
import javax.el.ImportHandler;
import static io.atlassian.util.adapter.util.WrapperUtil.applyIfNonNull;
import static java.util.Objects.requireNonNull;
public class JavaXImportHandlerAdapter extends ImportHandler {
private final jakarta.el.ImportHandler delegate;
public static ImportHandler from(jakarta.el.ImportHandler delegate) {
if (delegate instanceof JakartaImportHandlerAdapter castDelegate) {
return castDelegate.getDelegate();
}
return applyIfNonNull(delegate, JavaXImportHandlerAdapter::new);
}
JavaXImportHandlerAdapter(jakarta.el.ImportHandler delegate) {
this.delegate = requireNonNull(delegate);
}
public jakarta.el.ImportHandler getDelegate() {
return delegate;
}
@Override
public void importStatic(String name) throws ELException {
delegate.importStatic(name);
}
@Override
public void importClass(String name) throws ELException {
delegate.importClass(name);
}
@Override
public void importPackage(String packageName) {
if (delegate == null) {
return; // Ignore call from super constructor
}
delegate.importPackage(packageName);
}
@Override
public Class> resolveClass(String name) {
return delegate.resolveClass(name);
}
@Override
public Class> resolveStatic(String name) {
return delegate.resolveStatic(name);
}
}