internal static Pair <Type, T> ResolveFromLocalAndPath <T>(
            string soughtName,
            ClassProvidedCompileTimeRegistry locals,
            PathRegistry <string, ClassProvided> path,
            string objectName,
            ICollection <string> moduleUses,
            ModuleDependenciesCompileTime moduleDependencies,
            Func <T, ISet <string> > namesProvider)
            where T : Attribute
        {
            if (locals.Classes.IsEmpty() && path.IsEmpty())
            {
                return(null);
            }

            var annotationType = typeof(T);

            try {
                // try resolve from local
                var localPair = ResolveFromLocal(soughtName, locals, annotationType, objectName, namesProvider);
                if (localPair != null)
                {
                    return(localPair);
                }

                // try resolve from path, using module-uses when necessary
                return(ResolveFromPath(soughtName, path, annotationType, objectName, moduleUses, moduleDependencies, namesProvider));
            }
            catch (ExprValidationException ex) {
                throw new EPException(ex.Message, ex);
            }
        }
 public ClassProvidedCompileTimeResolverImpl(
     string moduleName,
     ICollection <string> moduleUses,
     ClassProvidedCompileTimeRegistry locals,
     PathRegistry <string, ClassProvided> path,
     ModuleDependenciesCompileTime moduleDependencies,
     bool isFireAndForget)
 {
     this._moduleName         = moduleName;
     this._moduleUses         = moduleUses;
     this._locals             = locals;
     this._path               = path;
     this._moduleDependencies = moduleDependencies;
     this._isFireAndForget    = isFireAndForget;
 }
        private static Pair <Type, T> ResolveFromLocal <T>(
            string soughtName,
            ClassProvidedCompileTimeRegistry locals,
            Type annotationType,
            string objectName,
            Func <T, ISet <string> > namesProvider)
            where T : Attribute
        {
            var foundLocal = new List <Pair <Type, T> >();

            foreach (var entry in locals.Classes)
            {
                EPTypeHelper.TraverseAnnotations <T>(
                    entry.Value.ClassesMayNull,
                    (clazz, annotation) => {
                    var t     = (T)annotation;
                    var names = namesProvider.Invoke(t);
                    foreach (var name in names)
                    {
                        if (soughtName.Equals(name))
                        {
                            foundLocal.Add(new Pair <Type, T>(clazz, t));
                        }
                    }
                });
            }

            if (foundLocal.Count > 1)
            {
                throw GetDuplicateSingleRow(soughtName, objectName);
            }

            if (foundLocal.Count == 1)
            {
                return(foundLocal[0]);
            }

            return(null);
        }