io.atlassian.util.adapter.jakarta.el.JakartaMethodExpressionAdapter 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.el;
import io.atlassian.util.adapter.javax.el.JavaXMethodExpressionAdapter;
import jakarta.el.ELContext;
import jakarta.el.MethodExpression;
import jakarta.el.MethodInfo;
import static io.atlassian.util.adapter.javax.JavaXJspAdapters.asJavaXJsp;
import static io.atlassian.util.adapter.util.WrapperUtil.applyIfNonNull;
import static java.util.Objects.requireNonNull;
public class JakartaMethodExpressionAdapter extends MethodExpression {
private final javax.el.MethodExpression delegate;
public static MethodExpression from(javax.el.MethodExpression delegate) {
if (delegate instanceof JavaXMethodExpressionAdapter castDelegate) {
return castDelegate.getDelegate();
}
return applyIfNonNull(delegate, JakartaMethodExpressionAdapter::new);
}
JakartaMethodExpressionAdapter(javax.el.MethodExpression delegate) {
this.delegate = requireNonNull(delegate);
}
public javax.el.MethodExpression getDelegate() {
return delegate;
}
@Override
public boolean isParametersProvided() {
return delegate.isParametersProvided();
}
@Override
public MethodInfo getMethodInfo(ELContext context) {
return JakartaMethodInfoAdapter.from(delegate.getMethodInfo(asJavaXJsp(context)));
}
@Override
public Object invoke(ELContext context, Object[] params) {
return delegate.invoke(asJavaXJsp(context), params);
}
@Override
public String getExpressionString() {
return delegate.getExpressionString();
}
@Override
public boolean equals(Object obj) {
return delegate.equals(obj);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public boolean isLiteralText() {
return delegate.isLiteralText();
}
}