package com.hammurapi.common;


/**
 * Context which can be modified.
 * @author Pavel Vlasov.
 *
 */
public interface MutableContext extends Context {
	
	/**
	 * Binds named object.
	 * @param name Object name.
	 * @param obj Object reference. Cannot be null.
	 */
	void bind(String name, Object obj);
	
	/**
	 * Unbinds named object.
	 * @param name
	 * @return Object previously bound to given name.
	 */
	Object unbind(String name);
	
	/**
	 * Registers service.
	 * @param <T> Service implementation type.
	 * @param type Service type.
	 * @param service Service instance.
	 */
	<T> void register(Class<? super T> type, T service);
	
	/**
	 * Removes service registration.
	 * @param <T>
	 * @param type
	 * @param service
	 */
	<T> void unregister(Class<? super T> type, T service);
}
