类 DefaultObjectFactory
java.lang.Object
com.dtflys.forest.reflection.DefaultObjectFactory
- 所有已实现的接口:
ForestObjectFactory
默认Forest对象工厂
直接使用Java反射对Class进行实例化
- 从以下版本开始:
- 1.5.2
- 作者:
- gongjun [dt_flys@hotmail.com]
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明<T> T获取Forest接口对象(默认方式)protected <T> TgetObjectFromCache(Class<T> clazz) 从缓存获取Forest接口对象实例voidregisterConstructor(Class<?> cls, ObjectConstructor constructor) 注册构造对象接口voidregisterObject(Class<?> cls, Object o) 注册forest对象
-
构造器详细资料
-
DefaultObjectFactory
public DefaultObjectFactory()
-
-
方法详细资料
-
getObjectFromCache
从缓存获取Forest接口对象实例- 类型参数:
T- Forest对象接口类泛型- 参数:
clazz- Forest对象接口类- 返回:
- Forest对象实例
-
getObject
获取Forest接口对象(默认方式)适用于Forest相关接口(非请求客户端接口)和回调函数的工厂接口
当这些类没有实例的情况下,会先实例化并缓存下来,以后再取会通过缓存获取对象
实例化方式:通过JDK反射去实例化对象
- 指定者:
getObject在接口中ForestObjectFactory- 类型参数:
T- Forest对象接口类泛型- 参数:
clazz- Forest对象接口类- 返回:
- Forest对象实例
-
registerConstructor
从接口复制的说明:ForestObjectFactory注册构造对象接口- 指定者:
registerConstructor在接口中ForestObjectFactory- 参数:
cls- Forest对象接口类constructor- 对象构造接口类
-
registerObject
从接口复制的说明:ForestObjectFactory注册forest对象- 指定者:
registerObject在接口中ForestObjectFactory- 参数:
cls- 对象类型o- 对象实例
-