private FilterDef CreateFilterDefinition(FullTextFilterDefAttribute att)
		{
			try
			{
			    Activator.CreateInstance(att.Impl);
			}
			catch (Exception ex)
			{
				throw new SearchException("Unable to create Filter class: " + att.Impl.FullName, ex);
			}

			var filterDefinition = new FilterDef
			{
				Name = att.Name, 
				Cache = att.Cache, 
				Impl = att.Impl
			};

			foreach (var method in filterDefinition.Impl.GetMethods())
			{
				if (AttributeUtil.HasAttribute<FactoryAttribute>(method))
				{
					if (filterDefinition.FactoryMethod != null)
						throw new SearchException("Multiple Factory methods found " + filterDefinition.Name + ":" +
												  filterDefinition.Impl.FullName + "." + method.Name);
					filterDefinition.FactoryMethod = method;
				}

				if (AttributeUtil.HasAttribute<KeyAttribute>(method))
				{
					if (filterDefinition.KeyMethod != null)
						throw new SearchException("Multiple Key methods found " + filterDefinition.Name + ":" +
												  filterDefinition.Impl.FullName + "." + method.Name);
					filterDefinition.KeyMethod = method;
				}
			}

			foreach (var prop in filterDefinition.Impl.GetProperties())
			{
				if (AttributeUtil.HasAttribute<FilterParameterAttribute>(prop))
				{
					filterDefinition.Setters[prop.Name] = prop;
				}
			}

			return filterDefinition;
		}
 public bool TryGetFilterDefinition(string name, out FilterDef filter)
 {
     return filterDefinitions.TryGetValue(name, out filter);
 }
        private FilterDef BuildFilterDef(FullTextFilterDefAttribute attribute)
        {
            var filterDef = new FilterDef
            {
                Name = attribute.Name,
                Impl = attribute.Impl,
                Cache = attribute.Cache
            };

            try {
                Activator.CreateInstance(filterDef.Impl);
            }
            catch (Exception e) {
                throw new SearchException("Unable to create Filter class: " + filterDef.Impl.FullName, e);
            }

            foreach (var method in filterDef.Impl.GetMethods())
            {
                if (AttributeUtil.HasAttribute<FactoryAttribute>(method))
                {
                    if (filterDef.FactoryMethod != null)
                        throw new SearchException("Multiple Factory methods found " + filterDef.Name + ":" +
                                                  filterDef.Impl.FullName + "." + method.Name);
                    filterDef.FactoryMethod = method;
                }

                if (AttributeUtil.HasAttribute<KeyAttribute>(method))
                {
                    if (filterDef.KeyMethod != null)
                        throw new SearchException("Multiple Key methods found " + filterDef.Name + ":" +
                                                  filterDef.Impl.FullName + "." + method.Name);
                    filterDef.KeyMethod = method;
                }
            }

            // Use properties rather than the Java setter logic idea
            foreach (PropertyInfo prop in filterDef.Impl.GetProperties())
            {
                if (AttributeUtil.HasAttribute<FilterParameterAttribute>(prop))
                {
                    filterDef.AddSetter(prop);
                }
            }

            return filterDef;
        }
 public void AddFilterDefinition(string name, FilterDef filter)
 {
     filterDefinitions.Add(name, filter);
 }
        private void BindFilterDef(FullTextFilterDefAttribute defAnn, System.Type mappedClass)
        {
            if (filterDefinitions.ContainsKey(defAnn.Name))
                throw new SearchException("Multiple definitions of FullTextFilterDef.Name = " + defAnn.Name + ":" +
                                          mappedClass.FullName);

            FilterDef filterDef = new FilterDef();
            filterDef.Impl = defAnn.Impl;
            filterDef.Cache = defAnn.Cache;
            try
            {
                Activator.CreateInstance(filterDef.Impl);
            }
            catch (Exception e)
            {
                throw new SearchException("Unable to create Filter class: " + filterDef.Impl.FullName, e);
            }

            foreach (MethodInfo method in filterDef.Impl.GetMethods())
            {
                if (AttributeUtil.HasAttribute<FactoryAttribute>(method))
                {
                    if (filterDef.FactoryMethod != null)
                        throw new SearchException("Multiple Factory methods found " + defAnn.Name + ":" +
                                                  filterDef.Impl.FullName + "." + method.Name);
                    filterDef.FactoryMethod = method;
                }

                if (AttributeUtil.HasAttribute<KeyAttribute>(method))
                {
                    if (filterDef.KeyMethod != null)
                        throw new SearchException("Multiple Key methods found " + defAnn.Name + ":" +
                                                  filterDef.Impl.FullName + "." + method.Name);
                    filterDef.KeyMethod = method;
                }
            }

            // Use properties rather than the Java setter logic idea
            foreach (PropertyInfo prop in filterDef.Impl.GetProperties())
            {
                if (AttributeUtil.HasAttribute<FilterParameterAttribute>(prop))
                {
                    filterDef.AddSetter(prop);
                }
            }

            filterDefinitions[defAnn.Name] = filterDef;
        }