1 /* JFox, the OpenSource J2EE Application Server2 *3 * Distributable under GNU LGPL license by gun.org4 * more details please visit http://www.huihoo.org/jfox5 */6 package org.jfox.ioc.depend;7 8 import org.jfox.ioc.Registry;9 import org.jfox.ioc.exception.ComponentException;10 11 /**12 * 用来表示构造器的参数,在依赖注射的时候将解析参数的值,13 * 并注射到组件中。14 *15 * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>16 */17 18 public interface Dependency {19 20 public static Dependency[] EMPTY_PARAMETERS = new Dependency[0];21 22 /**23 * 参数的 Class24 *25 * @return26 */27 Class getType();28 29 /**30 * 取得参数的字符串值。31 * <br>32 * {@link org.jfox.ioc.depend.ComponentRefDependency}为依赖组件的ComponentName的toString33 * <br>34 * {@link org.jfox.ioc.depend.ObjectDependency} 为依赖对象的toString35 *36 */37 String getLiteralValue();38 39 /**40 * 解析该参数的值41 * <br>42 * {@link org.jfox.ioc.depend.ComponentRefDependency}为依赖组件的对象43 * <br>44 * {@link org.jfox.ioc.depend.ObjectDependency} 直接返回依赖对象45 *46 */47 Object resolveValue(Registry registry) throws ComponentException;48 49 }