public Injection getInjection(String jndiName, Class<?> clazz, Field field) {
    if (field == null || clazz == null) return null;

    List<Injection> injections = getInjections(clazz.getCanonicalName());
    if (injections == null) return null;
    Iterator<Injection> itor = injections.iterator();
    Injection injection = null;
    while (itor.hasNext() && injection == null) {
      Injection i = itor.next();
      if (i.isField() && field.getName().equals(i.getTarget().getName())) injection = i;
    }

    return injection;
  }
  public void inject(Object injectable) {
    if (injectable == null) return;

    // Get all injections pertinent to the Object by
    // looking at it's class hierarchy
    Class<?> clazz = injectable.getClass();

    while (clazz != null) {
      List<Injection> injections = _injectionMap.get(clazz.getCanonicalName());
      if (injections != null) {
        for (Injection i : injections) i.inject(injectable);
      }

      clazz = clazz.getSuperclass();
    }
  }
  public void add(Injection injection) {
    if ((injection == null) || injection.getTargetClass() == null) return;

    if (LOG.isDebugEnabled())
      LOG.debug(
          "Adding injection for class="
              + (injection.getTargetClass() + " on a " + (injection.getTarget().getName())));

    List<Injection> injections =
        (List<Injection>) _injectionMap.get(injection.getTargetClass().getCanonicalName());
    if (injections == null) {
      injections = new ArrayList<Injection>();
      _injectionMap.put(injection.getTargetClass().getCanonicalName(), injections);
    }
    injections.add(injection);
  }
  public Injection getInjection(
      String jndiName, Class<?> clazz, Method method, Class<?> paramClass) {
    if (clazz == null || method == null || paramClass == null) return null;

    List<Injection> injections = getInjections(clazz.getCanonicalName());
    if (injections == null) return null;
    Iterator<Injection> itor = injections.iterator();
    Injection injection = null;
    while (itor.hasNext() && injection == null) {
      Injection i = itor.next();
      if (i.isMethod()
          && i.getTarget().getName().equals(method.getName())
          && paramClass.equals(i.getParamClass())) injection = i;
    }

    return injection;
  }