io.atlassian.util.adapter.javax.el.JavaXValueExpressionAdapter 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.JakartaValueExpressionAdapter;
import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.el.ValueReference;
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 JavaXValueExpressionAdapter extends ValueExpression {
private final jakarta.el.ValueExpression delegate;
public static ValueExpression from(jakarta.el.ValueExpression delegate) {
if (delegate instanceof JakartaValueExpressionAdapter castDelegate) {
return castDelegate.getDelegate();
}
return applyIfNonNull(delegate, JavaXValueExpressionAdapter::new);
}
JavaXValueExpressionAdapter(jakarta.el.ValueExpression delegate) {
this.delegate = requireNonNull(delegate);
}
public jakarta.el.ValueExpression getDelegate() {
return delegate;
}
@Override
public ValueReference getValueReference(ELContext context) {
return JavaXValueReferenceAdapter.from(delegate.getValueReference(asJakartaJsp(context)));
}
@Override
public Object getValue(ELContext elContext) {
return delegate.getValue(asJakartaJsp(elContext));
}
@Override
public void setValue(ELContext elContext, Object o) {
delegate.setValue(asJakartaJsp(elContext), o);
}
@Override
public boolean isReadOnly(ELContext elContext) {
return delegate.isReadOnly(asJakartaJsp(elContext));
}
@Override
public Class> getType(ELContext elContext) {
return delegate.getType(asJakartaJsp(elContext));
}
@Override
public Class> getExpectedType() {
return delegate.getExpectedType();
}
@Override
public String getExpressionString() {
return delegate.getExpressionString();
}
@Override
public boolean equals(Object o) {
return delegate.equals(o);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public boolean isLiteralText() {
return delegate.isLiteralText();
}
}