internal static IFieldMapper <T> Build <T>(System.Reflection.PropertyInfo p, Version version, Analyzer externalAnalyzer)
        {
            var boost = p.GetCustomAttribute <DocumentBoostAttribute>(true);

            if (boost != null)
            {
                return(new ReflectionDocumentBoostMapper <T>(p));
            }

            var score = p.GetCustomAttribute <QueryScoreAttribute>(true);

            if (score != null)
            {
                return(new ReflectionScoreMapper <T>(p));
            }

            var  metadata = p.GetCustomAttribute <FieldAttribute>(true);
            var  numericFieldAttribute = p.GetCustomAttribute <NumericFieldAttribute>(true);
            Type type;

            var isCollection = IsCollection(p.PropertyType, out type);

            ReflectionFieldMapper <T> mapper;

            if (numericFieldAttribute != null)
            {
                mapper = NumericFieldMappingInfoBuilder.BuildNumeric <T>(p, type, numericFieldAttribute);
            }
            else
            {
                mapper = BuildPrimitive <T>(p, type, metadata, version, externalAnalyzer);
            }

            return(isCollection ? new CollectionReflectionFieldMapper <T>(mapper, type) : mapper);
        }
        internal static IFieldMapper <T> Build <T>(PropertyInfo p, Version version, Analyzer externalAnalyzer)
        {
            var score = p.GetCustomAttribute <QueryScoreAttribute>(true);

            if (score != null)
            {
                return(new ReflectionScoreMapper <T>(p));
            }

            var metadata = p.GetCustomAttribute <FieldAttribute>(true);
            var numericFieldAttribute = p.GetCustomAttribute <NumericFieldAttribute>(true);
            var type = p.PropertyType;

            var isCollection = IsCollection(p.PropertyType);

            if (isCollection)
            {
                type = p.PropertyType.GetGenericArguments()[0];
            }

            ReflectionFieldMapper <T> mapper;

            if (numericFieldAttribute != null)
            {
                mapper = NumericFieldMappingInfoBuilder.BuildNumeric <T>(p, type, numericFieldAttribute);
            }
            else
            {
                mapper = BuildPrimitive <T>(p, type, metadata, version, externalAnalyzer);
            }

            return(isCollection ? new CollectionReflectionFieldMapper <T>(mapper, type) : mapper);
        }