File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/Nest/CommonAbstractions/Infer Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments