Skip to content

Commit 8454c4a

Browse files
committed
inferrer was not checked in
1 parent aceb897 commit 8454c4a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
using System.Linq;
5+
6+
namespace Nest
7+
{
8+
public class Inferrer
9+
{
10+
private IdResolver IdResolver { get; }
11+
private IndexNameResolver IndexNameResolver { get; }
12+
private TypeNameResolver TypeNameResolver { get; }
13+
private FieldResolver FieldResolver { get; }
14+
15+
public Inferrer(IConnectionSettingsValues connectionSettings)
16+
{
17+
connectionSettings.ThrowIfNull(nameof(connectionSettings));
18+
this.IdResolver = new IdResolver(connectionSettings);
19+
this.IndexNameResolver = new IndexNameResolver(connectionSettings);
20+
this.TypeNameResolver = new TypeNameResolver(connectionSettings);
21+
this.FieldResolver = new FieldResolver(connectionSettings);
22+
}
23+
24+
public string Field(Field field) => this.FieldResolver.Resolve(field);
25+
26+
public string PropertyName(PropertyName property) => this.FieldResolver.Resolve(property);
27+
28+
public string IndexName<T>() where T : class => this.IndexNameResolver.Resolve<T>();
29+
30+
public string IndexName(IndexName index) => this.IndexNameResolver.Resolve(index);
31+
32+
public string Id<T>(T obj) where T : class => this.IdResolver.Resolve(obj);
33+
34+
public string Id(Type objType, object obj) => this.IdResolver.Resolve(objType, obj);
35+
36+
public string TypeName<T>() where T : class => this.TypeNameResolver.Resolve<T>();
37+
38+
public string TypeName(TypeName type) => this.TypeNameResolver.Resolve(type);
39+
}
40+
}

0 commit comments

Comments
 (0)