All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.yudichev.jiotty.appliance.ApplianceServerModule Maven / Gradle / Ivy

package net.yudichev.jiotty.appliance;

import com.google.inject.Key;
import net.yudichev.jiotty.common.inject.BaseLifecycleComponentModule;

import java.lang.annotation.Annotation;

import static com.google.common.base.Preconditions.checkNotNull;

public final class ApplianceServerModule extends BaseLifecycleComponentModule {
    private final String applianceId;
    private final Class bindingAnnotation;

    public ApplianceServerModule(String applianceId, Class bindingAnnotation) {
        this.applianceId = checkNotNull(applianceId);
        this.bindingAnnotation = checkNotNull(bindingAnnotation);
    }

    @Override
    protected void configure() {
        bindConstant().annotatedWith(ApplianceServer.ApplianceId.class).to(applianceId);
        bind(Appliance.class).annotatedWith(ApplianceServer.Dependency.class).to(Key.get(Appliance.class, bindingAnnotation));
        boundLifecycleComponent(ApplianceServer.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy