类 SpringLiteContext
- java.lang.Object
-
- network.nerve.core.core.ioc.SpringLiteContext
-
public class SpringLiteContext extends Object
简化版本的ROC框架,参考spring-framework的使用方式,实现简单的依赖注入和动态代理实现的面向切面编程The simplified version of the ROC framework, referring to the use of the spring-framework, implements a simple dependency injection and aspect-oriented programming for dynamic proxy implementations.
- 作者:
- Eva Wang
-
-
构造器概要
构造器 构造器 说明 SpringLiteContext()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static booleancheckBeanOk(Object bean)检查实例的状态,是否已完成组装,即所有的属性都已自动赋值 Check the status of the instance, and whether the assembly has been completed, that is, all properties are automatically assigned.static Collection<Object>getAllBeanList()static <T> TgetBean(Class<T> beanClass)根据类型获取对象池中的对象 Gets the object in the object pool according to the type.static <T> TgetBean(Class<T> beanClass, String specifiedBeanName)根据类型获取对象池中的对象 Gets the object in the object pool according to the type.static ObjectgetBeanByClass(String clazzStr)根据对象类型字符串获取该类型实例的名称 Gets the name of the type instance according to the object type.static <T> List<T>getBeanList(Class<T> beanClass)获取一个类型的所有实例 Gets all instances of a type.static AnnotationgetFromArray(Annotation[] anns, Class clazz)从数组中获取指定的注解类型的实例 Gets an instance of the specified annotation type from the array.static voidinit(String... packName)使用默认的拦截器加载roc环境 Load the roc environment with the default interceptor.static voidinit(String packName, net.sf.cglib.proxy.MethodInterceptor interceptor)根据传入的参数加载roc环境 Load the roc environment based on the incoming parameters.static voidinit(net.sf.cglib.proxy.MethodInterceptor interceptor, String... packName)static voidputBean(Class clazz)向上下文中加入一个托管对象,该对象是根据传入的类型,使用动态代理的方式实例化的 A managed object is added to the context, which is instantiated using a dynamic proxy based on the incoming type.static voidputBean(Class clazz, boolean proxy)static voidputBean(String beanName, Object bean)static voidremoveBean(Class clazz)从上下文中删除一个类型的所有实例,请谨慎调用 Delete all instances of a type from the context, please call carefully.
-
-
-
方法详细资料
-
init
public static void init(String... packName)
使用默认的拦截器加载roc环境 Load the roc environment with the default interceptor.- 参数:
packName- 扫描的根路径,The root package of the scan.
-
init
public static void init(String packName, net.sf.cglib.proxy.MethodInterceptor interceptor)
根据传入的参数加载roc环境 Load the roc environment based on the incoming parameters.- 参数:
packName- 扫描的根路径,The root package of the scan.interceptor- 方法拦截器,Method interceptor
-
init
public static void init(net.sf.cglib.proxy.MethodInterceptor interceptor, String... packName)
-
getBeanByClass
public static Object getBeanByClass(String clazzStr)
根据对象类型字符串获取该类型实例的名称 Gets the name of the type instance according to the object type.
-
getFromArray
public static Annotation getFromArray(Annotation[] anns, Class clazz)
从数组中获取指定的注解类型的实例 Gets an instance of the specified annotation type from the array.- 参数:
anns- 注解实例数组,Annotated instance arrayclazz- 目标注解类型,Target annotation type- 返回:
- Annotation
-
getBean
public static <T> T getBean(Class<T> beanClass)
根据类型获取对象池中的对象 Gets the object in the object pool according to the type.- 类型参数:
T- 泛型- 参数:
beanClass- 对象类型- 返回:
- 目标对象
-
putBean
public static void putBean(Class clazz) throws NulsException
向上下文中加入一个托管对象,该对象是根据传入的类型,使用动态代理的方式实例化的 A managed object is added to the context, which is instantiated using a dynamic proxy based on the incoming type.- 参数:
clazz- 对象类型- 抛出:
NulsException
-
putBean
public static void putBean(Class clazz, boolean proxy) throws NulsException
- 抛出:
NulsException
-
removeBean
public static void removeBean(Class clazz)
从上下文中删除一个类型的所有实例,请谨慎调用 Delete all instances of a type from the context, please call carefully.
-
checkBeanOk
public static boolean checkBeanOk(Object bean)
检查实例的状态,是否已完成组装,即所有的属性都已自动赋值 Check the status of the instance, and whether the assembly has been completed, that is, all properties are automatically assigned.- 参数:
bean- 对象实例
-
getBeanList
public static <T> List<T> getBeanList(Class<T> beanClass)
获取一个类型的所有实例 Gets all instances of a type.- 类型参数:
T- 泛型- 参数:
beanClass- 类型- 返回:
- 该类型的所有实例,all instances of the type;
-
getAllBeanList
public static Collection<Object> getAllBeanList()
-
-