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