aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/language/provider/SimpleLinguisticsProvider.java
blob: 169c9f1a2a4f0c95158c4c4529ca3be7d92968dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.language.provider;

import com.google.inject.Inject;
import com.yahoo.language.simple.SimpleLinguistics;
import com.yahoo.container.di.componentgraph.Provider;
import com.yahoo.language.Linguistics;
import com.yahoo.language.simple.SimpleLinguisticsConfig;

/**
 * Provides simple linguistics if no linguistics component has been explicitly configured
 * (dependency injection will fallback to providers if no components of the requested type is found).
 *
 * @author bratseth
 */
public class SimpleLinguisticsProvider implements Provider<Linguistics> {

    private final Linguistics linguistics;

    @SuppressWarnings("deprecation")
    @Inject
    public SimpleLinguisticsProvider(SimpleLinguisticsConfig config) {
        linguistics = new SimpleLinguistics(config);
    }

    @Override
    public Linguistics get() { return linguistics; }

    @Override
    public void deconstruct() {}

}