io.atlassian.util.adapter.jakarta.servlet.JakartaMultipartConfigElementAdapter 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.jakarta.servlet;
import io.atlassian.util.adapter.Adapted;
import io.atlassian.util.adapter.javax.servlet.JavaXMultipartConfigElementAdapter;
import jakarta.servlet.MultipartConfigElement;
import static io.atlassian.util.adapter.util.WrapperUtil.applyIfNonNull;
import static java.util.Objects.requireNonNull;
public class JakartaMultipartConfigElementAdapter extends MultipartConfigElement implements Adapted {
private final javax.servlet.MultipartConfigElement delegate;
public static MultipartConfigElement from(javax.servlet.MultipartConfigElement delegate) {
if (delegate instanceof JavaXMultipartConfigElementAdapter castDelegate) {
return castDelegate.getDelegate();
}
return applyIfNonNull(delegate, JakartaMultipartConfigElementAdapter::new);
}
protected JakartaMultipartConfigElementAdapter(javax.servlet.MultipartConfigElement delegate) {
super((String) null);
this.delegate = requireNonNull(delegate);
}
@Override
public javax.servlet.MultipartConfigElement getDelegate() {
return delegate;
}
@Override
public String getLocation() {
return delegate.getLocation();
}
@Override
public long getMaxFileSize() {
return delegate.getMaxFileSize();
}
@Override
public long getMaxRequestSize() {
return delegate.getMaxRequestSize();
}
@Override
public int getFileSizeThreshold() {
return delegate.getFileSizeThreshold();
}
}