package ru.kirillius.pf.sdn.core;

/**
 * Convenience base implementation that wires component configuration and context dependencies.
 */
public abstract class AbstractComponent<CT> implements Component<CT> {
    protected final CT config;
    protected final Context context;

    /**
     * Loads the component configuration from the shared storage and stores the context reference.
     */
    @SuppressWarnings({"unchecked", "rawtypes"})
    public AbstractComponent(Context context) {
        config = (CT) context.getConfig().getComponentsConfig().getConfig((Class) getClass());
        this.context = context;
    }
}
