/src/LinFu.AOP.Interfaces/IFieldInterceptor.cs

http://github.com/philiplaureano/LinFu · C# · 30 lines · 9 code · 2 blank · 19 comment · 0 complexity · d89797e9867d84f614283722bc66bfdf MD5 · raw file

  1. namespace LinFu.AOP.Interfaces
  2. {
  3. /// <summary>
  4. /// Represents a type that can intercept field getter and setter calls.
  5. /// </summary>
  6. public interface IFieldInterceptor
  7. {
  8. /// <summary>
  9. /// Determines whether or not a field can be intercepted.
  10. /// </summary>
  11. /// <param name="context">The context that describes the field to be intercepted.</param>
  12. /// <returns><c>true</c> if it can be intercepted; otherwise, it will return <c>false</c>.</returns>
  13. bool CanIntercept(IFieldInterceptionContext context);
  14. /// <summary>
  15. /// Gets the value of a field.
  16. /// </summary>
  17. /// <param name="context">The context that describes the field to be intercepted.</param>
  18. /// <returns>The value of the target field.</returns>
  19. object GetValue(IFieldInterceptionContext context);
  20. /// <summary>
  21. /// Sets the value of a field.
  22. /// </summary>
  23. /// <param name="context">The context that describes the field to be intercepted.</param>
  24. /// <param name="value">The original value that will be assigned to the target field.</param>
  25. /// <returns>The value that will be assigned to the target field.</returns>
  26. object SetValue(IFieldInterceptionContext context, object value);
  27. }
  28. }