All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.atlassian.util.adapter.javax.el.JavaXFunctionMapperAdapter Maven / Gradle / Ivy

Go to download

A collection of classes for adapting Servlet API 4.0 objects to Servlet API 5.0 and vice versa.

There is a newer version: 0.1.0
Show newest version
package io.atlassian.util.adapter.javax.el;

import io.atlassian.util.adapter.jakarta.el.JakartaFunctionMapperAdapter;

import javax.el.FunctionMapper;
import java.lang.reflect.Method;

import static io.atlassian.util.adapter.util.WrapperUtil.applyIfNonNull;
import static java.util.Objects.requireNonNull;

public class JavaXFunctionMapperAdapter extends FunctionMapper {

    private final jakarta.el.FunctionMapper delegate;

    public static FunctionMapper from(jakarta.el.FunctionMapper delegate) {
        if (delegate instanceof JakartaFunctionMapperAdapter castDelegate) {
            return castDelegate.getDelegate();
        }
        return applyIfNonNull(delegate, JavaXFunctionMapperAdapter::new);
    }

    JavaXFunctionMapperAdapter(jakarta.el.FunctionMapper delegate) {
        this.delegate = requireNonNull(delegate);
    }

    public jakarta.el.FunctionMapper getDelegate() {
        return delegate;
    }

    @Override
    public void mapFunction(String prefix, String localName, Method meth) {
        delegate.mapFunction(prefix, localName, meth);
    }

    @Override
    public Method resolveFunction(String s, String s1) {
        return delegate.resolveFunction(s, s1);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy