private IProperty GetProperty(PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { var property = _visitor.Visit(propertyInfo, attribute); if (property != null) return property; if (propertyInfo.GetGetMethod().IsStatic) return null; if (attribute != null) property = attribute; else property = InferProperty(propertyInfo.PropertyType); var objectProperty = property as IObjectProperty; if (objectProperty != null) { var type = GetUnderlyingType(propertyInfo.PropertyType); var seenTypes = new ConcurrentDictionary<Type, int>(_seenTypes); seenTypes.AddOrUpdate(type, 0, (t, i) => ++i); var walker = new PropertyWalker(type, _visitor, _maxRecursion, seenTypes); objectProperty.Properties = walker.GetProperties(seenTypes, _maxRecursion); } _visitor.Visit(property, propertyInfo, attribute); return property; }
public void Visit(IProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { var nestedType = type as INestedProperty; if (nestedType != null) Visit(nestedType, propertyInfo, attribute); var objectType = type as IObjectProperty; if (objectType != null) Visit(objectType, propertyInfo, attribute); var binaryType = type as IBinaryProperty; if (binaryType != null) Visit(binaryType, propertyInfo, attribute); var booleanType = type as IBooleanProperty; if (booleanType != null) Visit(booleanType, propertyInfo, attribute); var dateType = type as IDateProperty; if (dateType != null) Visit(dateType, propertyInfo, attribute); var numberType = type as INumberProperty; if (numberType != null) Visit(numberType, propertyInfo, attribute); var stringType = type as IStringProperty; if (stringType != null) Visit(stringType, propertyInfo, attribute); var attachmentType = type as IAttachmentProperty; if (attachmentType != null) Visit(attachmentType, propertyInfo, attribute); var geoShapeType = type as IGeoShapeProperty; if (geoShapeType != null) Visit(geoShapeType, propertyInfo, attribute); var geoPointType = type as IGeoPointProperty; if (geoPointType != null) Visit(geoPointType, propertyInfo, attribute); var completionType = type as ICompletionProperty; if (completionType != null) Visit(completionType, propertyInfo, attribute); var ipType = type as IIpProperty; if (ipType != null) Visit(ipType, propertyInfo, attribute); var murmurType = type as IMurmur3HashProperty; if (murmurType != null) Visit(murmurType, propertyInfo, attribute); var tokenCountType = type as ITokenCountProperty; if (tokenCountType != null) Visit(tokenCountType, propertyInfo, attribute); }
public virtual IProperty Visit(PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) => null;
public void Visit(IProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { switch (type) { case INestedProperty nestedType: Visit(nestedType, propertyInfo, attribute); break; case IObjectProperty objectType: Visit(objectType, propertyInfo, attribute); break; case IBinaryProperty binaryType: Visit(binaryType, propertyInfo, attribute); break; case IBooleanProperty booleanType: Visit(booleanType, propertyInfo, attribute); break; case IDateProperty dateType: Visit(dateType, propertyInfo, attribute); break; case IDateNanosProperty dateNanosType: Visit(dateNanosType, propertyInfo, attribute); break; case INumberProperty numberType: Visit(numberType, propertyInfo, attribute); break; case ITextProperty textType: Visit(textType, propertyInfo, attribute); break; case IKeywordProperty keywordType: Visit(keywordType, propertyInfo, attribute); break; case IGeoShapeProperty geoShapeType: Visit(geoShapeType, propertyInfo, attribute); break; case IShapeProperty shapeType: Visit(shapeType, propertyInfo, attribute); break; case IGeoPointProperty geoPointType: Visit(geoPointType, propertyInfo, attribute); break; case ICompletionProperty completionType: Visit(completionType, propertyInfo, attribute); break; case IIpProperty ipType: Visit(ipType, propertyInfo, attribute); break; case IMurmur3HashProperty murmurType: Visit(murmurType, propertyInfo, attribute); break; case ITokenCountProperty tokenCountType: Visit(tokenCountType, propertyInfo, attribute); break; case IPercolatorProperty percolatorType: Visit(percolatorType, propertyInfo, attribute); break; case IJoinProperty joinType: Visit(joinType, propertyInfo, attribute); break; case IIntegerRangeProperty integerRangeType: Visit(integerRangeType, propertyInfo, attribute); break; case ILongRangeProperty longRangeType: Visit(longRangeType, propertyInfo, attribute); break; case IDoubleRangeProperty doubleRangeType: Visit(doubleRangeType, propertyInfo, attribute); break; case IFloatRangeProperty floatRangeType: Visit(floatRangeType, propertyInfo, attribute); break; case IDateRangeProperty dateRangeType: Visit(dateRangeType, propertyInfo, attribute); break; case IIpRangeProperty ipRangeType: Visit(ipRangeType, propertyInfo, attribute); break; case IRankFeatureProperty rankFeature: Visit(rankFeature, propertyInfo, attribute); break; case IRankFeaturesProperty rankFeatures: Visit(rankFeatures, propertyInfo, attribute); break; } }
public virtual void Visit(IConstantKeywordProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public override void Visit( INumberProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) //<1> Override the `Visit` method on `INumberProperty` and set `DocValues = false` { type.DocValues = false; }
/** Similarily, override the Visit method on IBooleanProperty and set DocValues = false */ public override void Visit(IBooleanProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { type.DocValues = false; }
public virtual void Visit(IRankFeaturesProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public virtual bool SkipProperty(PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) => false;
public void Visit(IDoubleRangeProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public void Visit(IJoinProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public void Visit(IPercolatorProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public virtual void Visit(ITokenCountProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public virtual void Visit(IMurmur3HashProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public virtual void Visit(IStringProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public virtual void Visit(IDateNanosProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public virtual IProperty Visit(PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) => null;
public virtual void Visit(IBooleanProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public override void Visit( IBooleanProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) //<2> Similarily, override the `Visit` method on `IBooleanProperty` and set `DocValues = false` { type.DocValues = false; }
public virtual void Visit(IHistogramProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { }
public override IProperty Visit(PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) => new StringProperty();
public void Visit(IProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { var nestedType = type as INestedProperty; if (nestedType != null) { Visit(nestedType, propertyInfo, attribute); } var objectType = type as IObjectProperty; if (objectType != null) { Visit(objectType, propertyInfo, attribute); } var binaryType = type as IBinaryProperty; if (binaryType != null) { Visit(binaryType, propertyInfo, attribute); } var booleanType = type as IBooleanProperty; if (booleanType != null) { Visit(booleanType, propertyInfo, attribute); } var dateType = type as IDateProperty; if (dateType != null) { Visit(dateType, propertyInfo, attribute); } var numberType = type as INumberProperty; if (numberType != null) { Visit(numberType, propertyInfo, attribute); } var stringType = type as IStringProperty; if (stringType != null) { Visit(stringType, propertyInfo, attribute); } var attachmentType = type as IAttachmentProperty; if (attachmentType != null) { Visit(attachmentType, propertyInfo, attribute); } var geoShapeType = type as IGeoShapeProperty; if (geoShapeType != null) { Visit(geoShapeType, propertyInfo, attribute); } var geoPointType = type as IGeoPointProperty; if (geoPointType != null) { Visit(geoPointType, propertyInfo, attribute); } var completionType = type as ICompletionProperty; if (completionType != null) { Visit(completionType, propertyInfo, attribute); } var ipType = type as IIpProperty; if (ipType != null) { Visit(ipType, propertyInfo, attribute); } var murmurType = type as IMurmur3HashProperty; if (murmurType != null) { Visit(murmurType, propertyInfo, attribute); } var tokenCountType = type as ITokenCountProperty; if (tokenCountType != null) { Visit(tokenCountType, propertyInfo, attribute); } }