/*
 *  Copyright 2016 UsefulMilk
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

/**
 * It is a simple framework to support dependency injection.
 *
 * <p> It can be used to decouple a dependency from a class. The main class responsible
 * to handle dependencies is {@link com.usefulmilk.context.MilkContext}, you can inject
 * all dependencies and retrieve instances injected.</p>
 *
 * <p>To create a MilkContext:</p>
 * <pre><code>
 *     MilkContext context = new MilkContext();
 * </code></pre>
 *
 * <p>There are two ways to inject dependency. One is by using
 * {@link com.usefulmilk.context.MilkContext.Injectable} annotation with
 * {@link com.usefulmilk.context.MilkContext#inject(java.lang.Object)} method and another is by
 * setting explicit {@link java.lang.Class} in
 * {@link com.usefulmilk.context.MilkContext#inject(java.lang.Object, java.lang.Class)} method.</p>
 * <pre><code>
 *  {@literal}@MilkContext.Injectable
 *  public interface Foo{
 *      void foo();
 *  }
 *
 *  public class DefaultFoo implements Foo{
 *      public void foo(){
 *          System.out.println("DefaultFoo.foo()");
 *      }
 *  }
 *
 *  ...
 *
 *  //If you want to inject with annotations:
 *  context.inject(new DefaultFoo());
 *
 *  ...
 *
 *  //If you don't want to use annotation, you can inject in this way:
 *  context.inject(new DefaultFoo(), Foo.class);
 * </code></pre>
 *
 * <p>It is done! To get the instance, just call MilkContext#getInstance() method:</p>
 * <pre><code>
 *  Foo foo = context.getInstance(Foo.class);
 *  foo.foo();
 * </code></pre>
 */
package com.usefulmilk.context;