/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

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