public IList <FilterDef> FullTextFilters(Type type) { return(AttributeUtil .GetAttributes <FullTextFilterDefAttribute>(type, false) .Select(CreateFilterDefinition) .ToList()); }
private void BuildFilterDefinitions(DocumentMapping classMapping) { foreach (var defAttribute in AttributeUtil.GetAttributes <FullTextFilterDefAttribute>(classMapping.MappedClass, false)) { classMapping.FullTextFilterDefinitions.Add(BuildFilterDef(defAttribute)); } }
private void BuildClass( DocumentMapping documentMapping, bool isRoot, string path, BuildContext context ) { IList <System.Type> hierarchy = new List <System.Type>(); System.Type currClass = documentMapping.MappedClass; do { hierarchy.Add(currClass); currClass = currClass.BaseType; // NB Java stops at null we stop at object otherwise we process the class twice // We also need a null test for things like ISet which have no base class/interface } while (currClass != null && currClass != typeof(object)); for (int index = hierarchy.Count - 1; index >= 0; index--) { currClass = hierarchy[index]; /** * Override the default analyzer for the properties if the class hold one * That's the reason we go down the hierarchy */ // NB Must cast here as we want to look at the type's metadata var localAnalyzer = GetAnalyzer(currClass); var analyzer = documentMapping.Analyzer ?? localAnalyzer; // Check for any ClassBridges var classBridgeAttributes = AttributeUtil.GetAttributes <ClassBridgeAttribute>(currClass); AttributeUtil.GetClassBridgeParameters(currClass, classBridgeAttributes); // Now we can process the class bridges foreach (var classBridgeAttribute in classBridgeAttributes) { var bridge = BuildClassBridge(classBridgeAttribute, analyzer); documentMapping.ClassBridges.Add(bridge); } // NB As we are walking the hierarchy only retrieve items at this level var propertyInfos = currClass.GetProperties( BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance ); foreach (var propertyInfo in propertyInfos) { BuildProperty(documentMapping, propertyInfo, analyzer, isRoot, path, context); } var fields = currClass.GetFields( BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance ); foreach (var fieldInfo in fields) { BuildProperty(documentMapping, fieldInfo, analyzer, isRoot, path, context); } } }
public IList <IFieldDefinition> FieldDefinitions(MemberInfo member) { return(AttributeUtil.GetAttributes <FieldAttribute>(member)); }
public IEnumerable <IParameterDefinition> BridgeParameters(ICustomAttributeProvider member) { return(AttributeUtil.GetAttributes <ParameterAttribute>(member) ?? Enumerable.Empty <IParameterDefinition>()); }
public IList <IClassBridgeDefinition> ClassBridges(Type type) { return(AttributeUtil.GetAttributes <ClassBridgeAttribute>(type)); }