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

io.github.snower.jaslock.spring.boot.KeyEvaluationContext Maven / Gradle / Ivy

Go to download

High-performance distributed sync service and atomic DB. Provides good multi-core support through lock queues, high-performance asynchronous binary network protocols. Can be used for spikes, synchronization, event notification, concurrency control. https://github.com/snower/slock

The newest version!
package io.github.snower.jaslock.spring.boot;

import org.springframework.context.expression.MethodBasedEvaluationContext;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.lang.Nullable;

import java.lang.reflect.Method;

public class KeyEvaluationContext extends MethodBasedEvaluationContext {
    protected final EvaluationContext parentContext;

    public KeyEvaluationContext(Object rootObject, Method method, Object[] arguments, ParameterNameDiscoverer parameterNameDiscoverer,
                                EvaluationContext parentContext) {
        super(rootObject, method, arguments, parameterNameDiscoverer);
        setPropertyAccessors(parentContext.getPropertyAccessors());
        setTypeLocator(parentContext.getTypeLocator());
        setBeanResolver(parentContext.getBeanResolver());
        this.parentContext = parentContext;
    }

    @Nullable
    public Object lookupVariable(String name) {
        Object value = super.lookupVariable(name);
        if(value == null && parentContext != null) {
            return parentContext.lookupVariable(name);
        }
        return value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy