    001package com.hammurapi.common;
    002
    003
    004/**
    005 * Context which can be modified.
    006 * @author Pavel Vlasov.
    007 *
    008 */
    009public interface MutableContext extends Context {
    010
    011        /**
    012         * Binds named object.
    013         * @param name Object name.
    014         * @param obj Object reference. Cannot be null.
    015         */
    016        void bind(String name, Object obj);
    017
    018        /**
    019         * Unbinds named object.
    020         * @param name
    021         * @return Object previously bound to given name.
    022         */
    023        Object unbind(String name);
    024
    025        /**
    026         * Registers service.
    027         * @param <T> Service implementation type.
    028         * @param type Service type.
    029         * @param service Service instance.
    030         */
    031        <T> void register(Class<? super T> type, T service);
    032
    033        /**
    034         * Removes service registration.
    035         * @param <T>
    036         * @param type
    037         * @param service
    038         */
    039        <T> void unregister(Class<? super T> type, T service);
    040}