/src/LinFu.Reflection/Interfaces/ILoader.cs

http://github.com/philiplaureano/LinFu · C# · 69 lines · 16 code · 8 blank · 45 comment · 0 complexity · c382285f9384f55a1426855957b1aef9 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. namespace LinFu.Reflection
  4. {
  5. /// <summary>
  6. /// Represents a generic interface for an abstract loader
  7. /// that can read configuration information from disk
  8. /// and apply it to a <typeparamref name="TTarget" /> instance.
  9. /// </summary>
  10. /// <typeparam name="TTarget">The class type being configured.</typeparam>
  11. public interface ILoader<TTarget>
  12. {
  13. /// <summary>
  14. /// The list of <see cref="ILoaderPlugin{TTarget}" />
  15. /// instances that will be used to
  16. /// signal the beginning and end of the
  17. /// load sequence.
  18. /// </summary>
  19. IList<ILoaderPlugin<TTarget>> Plugins { get; }
  20. /// <summary>
  21. /// The list of <see cref="IActionLoader{TTarget, TInput}" />
  22. /// instances responsible for configuring the <typeparamref name="TTarget" /> instance.
  23. /// </summary>
  24. IList<IActionLoader<TTarget, string>> FileLoaders { get; }
  25. /// <summary>
  26. /// Gets or sets the <see cref="IDirectoryListing" /> instance
  27. /// responsible for returning a list of filenames
  28. /// to the loader for processing.
  29. /// </summary>
  30. IDirectoryListing DirectoryLister { get; set; }
  31. /// <summary>
  32. /// The custom list of actions that will be
  33. /// performed prior to the beginning of a load operation.
  34. /// </summary>
  35. IList<Action<ILoader<TTarget>>> CustomLoaderActions { get; }
  36. /// <summary>
  37. /// The list of actions that will execute
  38. /// every time a target instance is configured.
  39. /// </summary>
  40. IList<Action<TTarget>> QueuedActions { get; }
  41. /// <summary>
  42. /// Loads the configuration using the files listed in
  43. /// the target <paramref name="directory" /> that match
  44. /// the given <paramref name="filespec">file pattern</paramref>.
  45. /// </summary>
  46. /// <param name="directory">The full path of the location to scan.</param>
  47. /// <param name="filespec">The wildcard file pattern string to use when specifying the target files.</param>
  48. void LoadDirectory(string directory, string filespec);
  49. /// <summary>
  50. /// Configures the <paramref name="target" /> instance
  51. /// using the configuration currently loaded from disk.
  52. /// </summary>
  53. /// <param name="target">The <typeparamref name="TTarget" /> instance to be configured.</param>
  54. void LoadInto(TTarget target);
  55. /// <summary>
  56. /// Clears the currently loaded configuration
  57. /// and resets the loader back to its defaults.
  58. /// </summary>
  59. void Reset();
  60. }
  61. }