Targets specific methods to be intercepted.
@param {Object} interfaceMethods all methods for the interface
@param {Object} interceptor an object/class which will receive notifications
@return {Object} interceptedMethods
504008
function (interfaceMethods, interceptor, allInterceptors) {
        var interceptedMethods = allInterceptors || {};
        // for a class object, intercept specific methods
        for (var m in interfaceMethods) {
            if (interfaceMethods.hasOwnProperty(m) && __hasBeenIntercepted(m, interceptor)) {
                (interceptedMethods[m] || (interceptedMethods[m] = [])).push({
                    fn : __callInterceptorMethod,
                    scope : interceptor
                });
            }
        }
        return interceptedMethods;
    }
348858
protected void preInvoke(Method m, Object [] args, String [] interceptorNames)
        throws InterceptorPivotException
    {
        //
        // If the implementation expects single threaded behavior and our container does
        // not guarantee it, then enforce it locally here
        //
        if (_invokeLock != null)
        {
            try { _invokeLock.acquire(); } catch (InterruptedException ie) { }
        }

        //
        // Process interceptors
        //
        if ( interceptorNames != null )
        {
            for ( String n : interceptorNames )
            {
                Interceptor i = ensureInterceptor( n );
                try
                {
                    i.preInvoke( this, m, args );
                }
                catch (InterceptorPivotException ipe)
                {
                    ipe.setInterceptorName(n);
                    throw ipe;
                }
            }
        }

        Vector<InvokeListener> invokeListeners = getInvokeListeners();
        if (invokeListeners.size() > 0)
        {
            for (InvokeListener listener : invokeListeners)
                listener.preInvoke(m, args);
        }
    }
464923
@RuntimeType
    public Object interceptClass(@AllArguments Object[] params, @Origin Method method,
                                 @SuperCall Callable<Object> callable) throws Throwable {
        return Interception.invokeWrap(interception, this.target, method, null, params,
            callable::call);
    }
292749
def method_missing(m, *args)
      res = @targets.inject([]) { |res, t| res << t.send(m, *args) }
      res[0]
    end
612845
function (res, args) {
        var interc = args.interc;
        if (interc.removed) {
            // the interceptor was removed in the mean time, call the original callback directly
            return this.$callback(args.origCb, res);
        }
        var info = args.info;
        info.step = "Callback";
        info.callback = args.origCb;
        info.callbackResult = res;
        info.cancelDefault = false;
        info.returnValue = null;
        this.$callback(interc, info);
        if (info.cancelDefault) {
            return info.returnValue;
        }
        return this.$callback(args.origCb, info.callbackResult);
    }
70805
@Internal
    public static Interceptor[] resolveAroundInterceptors(BeanContext beanContext, ExecutableMethod<?, ?> method, Interceptor... interceptors) {
        instrumentAnnotationMetadata(beanContext, method);
        return resolveInterceptorsInternal(method, Around.class, interceptors);
    }
675704
public static MethodHandleProxy proxyMethod(Object target,String methodName,Object ...args)
	{
		MethodHandle mh=findMethodHandle(target, methodName, args);
		if(mh!=null)
		{
			return new MethodHandleProxy(target, mh, args);
		}
		return null;
	}
470373
function showInterfaceJavaScript(intf, html) {
    html.push("<div class='show-JavaScript'><h3>JavaScript</h3><pre>")

    var line = ""

    line += "\n//"
    line += "\n<span class='interfaceName'>class " + intf.name + "</span>"
    html.push(line)

    intf.methods.forEach(function(method){
        showInterfaceJavaScriptMethod(intf, method, html)
    })

    html.push("</pre></div>")
}
360704
function(object, events) {
        if (!object.__isInterfaceImplemented('events')) {
            object.__implementInterface('events', this.interface);
        }

        object.__initEvents();

        _.each(events, function(eventListeners, eventName) {
            _.each(eventListeners, function(listener, listenerName) {
                object.__addEventListener(eventName, listenerName, listener);
            });
        });
    }
41510
public void setInterceptors(Object[] interceptors) // F87720
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.debug(tc, "setInterceptors interceptors = " + interceptors + ", for SFSB: " + this);
        }
        ivInterceptors = interceptors;
    }
1192245
@Requires("name != null")
  @Ensures({
    "result != null",
    "result == methodHandles.get(name)"
  })
  protected List<MethodContractHandle> internMethod(String name) {
    ArrayList<MethodContractHandle> handles = methodHandles.get(name);
    if (handles == null) {
      handles = new ArrayList<MethodContractHandle>();
      methodHandles.put(name, handles);
    }
    return handles;
  }
729488
private static <T, G extends T> void generateDrawMethod(DexMaker dexMaker,
                                                            TypeId<G> generatedType,
                                                            TypeId<T> baseType,
                                                            ViewMethod viewMethod) {
        final FieldId<G, Interceptor> interceptorField =
                generatedType.getField(INTERCEPTOR_TYPE, FIELD_NAME_INTERCEPTOR);

        final String methodName = viewMethod.getName();

        final MethodId<T, Void> superMethod = baseType.getMethod(VOID_TYPE, methodName, CANVAS_TYPE);
        final MethodId<Interceptor, Void> drawMethod =
                INTERCEPTOR_TYPE.getMethod(VOID_TYPE, methodName, VIEW_TYPE, CANVAS_TYPE);

        final MethodId<G, Void> methodId = generatedType.getMethod(VOID_TYPE, methodName, CANVAS_TYPE);
        final Code code = dexMaker.declare(methodId, PUBLIC);

        final Local<G> localThis = code.getThis(generatedType);
        final Local<Interceptor> nullInterceptor = code.newLocal(INTERCEPTOR_TYPE);
        final Local<Interceptor> localInterceptor = code.newLocal(INTERCEPTOR_TYPE);
        final Local<Canvas> localCanvas = code.getParameter(0, CANVAS_TYPE);

        code.iget(interceptorField, localInterceptor, localThis);
        code.loadConstant(nullInterceptor, null);

        // Interceptor is not null, call it.
        final Label interceptorNullCase = new Label();
        code.compare(Comparison.EQ, interceptorNullCase, nullInterceptor, localInterceptor);
        code.invokeVirtual(drawMethod, null, localInterceptor, localThis, localCanvas);
        code.returnVoid();

        // Interceptor is null, call super method.
        code.mark(interceptorNullCase);
        code.invokeSuper(superMethod, null, localThis, localCanvas);
        code.returnVoid();

        final MethodId<G, Void> callsSuperMethod =
                generatedType.getMethod(VOID_TYPE, viewMethod.getInvokeName(), CANVAS_TYPE);

        final Code superCode = dexMaker.declare(callsSuperMethod, PUBLIC);

        final Local<G> superThis = superCode.getThis(generatedType);
        final Local<Canvas> superLocalCanvas = superCode.getParameter(0, CANVAS_TYPE);
        superCode.invokeSuper(superMethod, null, superThis, superLocalCanvas);
        superCode.returnVoid();
    }
829095
private InterceptorMethodKind mapEjbCallbackName(String methodName)
    {
        for (InterceptorMethodKind kind : InterceptorMethodKind.values())
        {
            if (kind.isLifecycle() && methodName.equals(kind.getLifecycleCallbackMethodName()))
            {
                return kind;
            }
        }

        return null;
    }
1321585
@Override
	public Object invokeMethod(Object... args) {
		Assert.state(this.parameterTypes.length == args.length,
				"Wrong number of arguments, expected no more than: ["
						+ this.parameterTypes.length + "]");

		try {
			// Extract the target from an Advised as late as possible
			// in case it contains a lazy initialization
			Object target = extractTarget(this.object, this.method);
			return method.invoke(target, args);
		}
		catch (Exception e) {
			throw new IllegalArgumentException("Unable to invoke method: [" + this.method
					+ "] on object: [" + this.object + "] with arguments: ["
					+ Arrays.toString(args) + "]", e);
		}
	}
584738
function (args, commonInfo, interceptorIndex) {
        if (interceptorIndex >= commonInfo.nbInterceptors) {
            // end of recursion: call the real method:
            return this[commonInfo.method].apply(this, args);
        }
        var interc = commonInfo.interceptors[interceptorIndex];
        if (interc.removed) {
            // interceptor was removed in the mean time, skip it.
            return __callWrapper.call(this, info.args, commonInfo, interceptorIndex + 1);
        }
        var info = {
            step : "CallBegin",
            method : commonInfo.method,
            args : args,
            cancelDefault : false,
            returnValue : null
        };
        var asyncCbParam = commonInfo.asyncCbParam;
        if (asyncCbParam != null) {
            var callback = {
                fn : __callbackWrapper,
                scope : this,
                args : {
                    info : info,
                    interc : interc,
                    // save previous callback:
                    origCb : args[asyncCbParam]
                }
            };
            args[asyncCbParam] = callback;
            if (args.length <= asyncCbParam) {
                // We do this check and set the length property because the
                // "args" object comes
                // from the JavaScript arguments object, which is not a real
                // array so that the
                // length property is not updated automatically by the previous
                // assignation: args[asyncCbParam] = callback;
                args.length = asyncCbParam + 1;
            }
            info.callback = callback;
        }
        this.$callback(interc, info);
        if (!info.cancelDefault) {
            // call next wrapper or real method:
            try {
                info.returnValue = __callWrapper.call(this, info.args, commonInfo, interceptorIndex + 1);
            } catch (e) {
                info.exception = e;
            }
            info.step = "CallEnd";
            delete info.cancelDefault; // no longer useful in CallEnd
            // call the interceptor, even if it was removed in the mean time (so
            // that CallEnd is always called when
            // CallBegin has been called):
            this.$callback(interc, info);
            if ("exception" in info) {
                throw info.exception;
            }
        }
        return info.returnValue;
    }
530191
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
        throws Throwable {
        if (Object.class.equals(method.getDeclaringClass())) {
            return proxy.invokeSuper(obj, args);
        }

        List<WebElement> realElements = new ArrayList<>(locator.findElements());
        return getObject(realElements, method, args);
    }
907399
func InterceptMethod(intc InterceptorMethod, when When) {
	methodType := reflect.TypeOf(intc)
	if methodType.Kind() != reflect.Func || methodType.NumOut() != 1 || methodType.NumIn() != 1 {
		log.Fatalln("Interceptor method should have signature like",
			"'func (c *AppController) example() revel.Result' but was", methodType)
	}

	interceptors = append(interceptors, &Interception{
		When:     when,
		method:   intc,
		callable: reflect.ValueOf(intc),
		target:   methodType.In(0),
	})
}