summaryrefslogtreecommitdiff
path: root/lib/Resolve.cs
blob: 494beeda92fdb4c662eb8970ad70eed3476d7cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;

namespace jive
{
  static public class Resolve
  {
    static DependencyRegistry underlying_registry;
    static bool initialized;

    static public void initialize_with(DependencyRegistry registry)
    {
      underlying_registry = registry;
      initialized = registry != null;
    }

    static public DependencyToResolve the<DependencyToResolve>()
    {
      try
      {
        return underlying_registry.get_a<DependencyToResolve>();
      }
      catch (Exception e)
      {
        throw new DependencyResolutionException<DependencyToResolve>(e);
      }
    }

    static public bool is_initialized()
    {
      return initialized;
    }
  }
}