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

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

package net.yudichev.jiotty.appliance;

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

public abstract class ApplianceModule extends BaseLifecycleComponentModule implements ExposedKeyModule {
    private final Key exposedKey;

    protected ApplianceModule(SpecifiedAnnotation targetAnnotation) {
        exposedKey = targetAnnotation.specify(Appliance.class);
    }

    @Override
    public final Key getExposedKey() {
        return exposedKey;
    }

    @Override
    protected final void configure() {
        Key implKey = configureDependencies();

        bind(exposedKey).to(implKey);
        expose(exposedKey);
    }

    protected abstract Key configureDependencies();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy