@Override public Object getValue(RuntimeContext runtimeContext) { return contextAccessor.getContext(getType(), runtimeContext); } }
@Override public Object getValue(RuntimeContext runtimeContext) { return contextAccessor.getContext(getType(), runtimeContext); } }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // use runtimeContext from TLS RuntimeContext runtimeContext = RuntimeContextTLS.getRuntimeContext(); if (runtimeContext == null) { if("toString".equals(method.getName()) && (args == null || args.length == 0)) { return "Proxy for " + contextClass.getName(); } throw new IllegalStateException(); } // get the real context from the // RuntimeContext // We need to call getContext() instead of getContextFromAccessor() as some context will be created from the context resolvers Object context = getContext(contextClass, runtimeContext); // invoke the method on the real // context return method.invoke(context, args); } });