MethodInterceptor

目录

1 MethodInterceptor

1.1 引用文件

1.2 /// The default method interceptors that resolve MVC/WebAPI style action filters to execute before and after the invocation

1.3 /// Create a proxy with provided target

  1. MethodInterceptor
    1. 引用文件

using System;

using System.Collections.Generic;

using System.Linq;

using System.Reflection;

using System.Threading.Tasks;

using Flatwhite.Core.Provider;

namespace Flatwhite.Core

{

    ///

    1.     /// The default method interceptors that resolve MVC/WebAPI style action filters to execute before and after the invocation

    ///

    public class MethodInterceptor : DispatchProxy where T : class

    {

        private static readonly MethodInfo HandleAsyncWithTypeMethod = typeof (MethodInterceptor).GetMethod(nameof(HandleAsyncWithType), BindingFlags.Instance | BindingFlags.NonPublic);

    private T _decorated;

        private IAttributeProvider _attributeProvider;

        private IContextProvider _contextProvider;

///

    1. /// Create a proxy with provided target

///

///

///

///

///

    public static T Create(T decorated, IContextProvider contextProvider, IAttributeProvider attributeProvider)

    {

    object proxy = Create>();

    ((MethodInterceptor) proxy).SetParameters(decorated, contextProvider, attributeProvider);

    return (T) proxy;

    }

你可能感兴趣的:(Flatwhite,java,servlet,开发语言)