PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/LinFu.AOP.Interfaces/FieldInterceptionContext.cs

http://github.com/philiplaureano/LinFu
C# | 49 lines | 19 code | 7 blank | 23 comment | 0 complexity | db98901d63ed656db31613a44446eb7f MD5 | raw file
 1using System;
 2using System.Reflection;
 3
 4namespace LinFu.AOP.Interfaces
 5{
 6    /// <summary>
 7    ///     Represents a class that describes the state of a field just as it is being intercepted by a
 8    ///     <see cref="IFieldInterceptor" />.
 9    /// </summary>
10    public class FieldInterceptionContext : IFieldInterceptionContext
11    {
12        /// <summary>
13        ///     Initializes a new instance of the FieldInterceptionContext class.
14        /// </summary>
15        /// <param name="target">The target that hosts the given field.</param>
16        /// <param name="targetMethod">The method that accessed the target field.</param>
17        /// <param name="targetField">The field currently being accessed by the target method.</param>
18        /// <param name="hostType">The type that hosts the target field.</param>
19        public FieldInterceptionContext(object target, MethodBase targetMethod, FieldInfo targetField, Type hostType)
20        {
21            Target = target;
22            TargetMethod = targetMethod;
23            TargetField = targetField;
24            HostType = hostType;
25        }
26
27
28        /// <summary>
29        ///     Gets a value indicating the target instance that is attached to the target field.
30        /// </summary>
31        public object Target { get; internal set; }
32
33
34        /// <summary>
35        ///     Gets a value indicating the host method that is currently accessing the target field.
36        /// </summary>
37        public MethodBase TargetMethod { get; internal set; }
38
39        /// <summary>
40        ///     Gets a value indicating the field that is currently being accessed by the target method.
41        /// </summary>
42        public FieldInfo TargetField { get; internal set; }
43
44        /// <summary>
45        ///     Gets a value indicating the <see cref="System.Type" /> that holds the target field.
46        /// </summary>
47        public Type HostType { get; internal set; }
48    }
49}