io.github.snower.jaslock.spring.boot.KeyEvaluationContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaslock-spring-boot Show documentation
Show all versions of jaslock-spring-boot Show documentation
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;
}
}