public class DependUtil extends Object
| Constructor and Description |
|---|
DependUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Function<T,Boolean> |
canInj(Class<T> type,
Field field,
Depend dependAnnotation)
判断一个类中的依赖是否可以进行注入
函数形式
|
static <T> BiConsumer<T,DependGetter> |
doInj(Class<T> type,
Field field,
Depend dependAnnotation,
Function<DependGetter,Depend> getter)
对字段进行注入
函数形式
仅使用额外参数
|
static <T> Consumer<T> |
doInj(Class<T> type,
Field field,
Depend dependAnnotation,
Supplier<Depend> getter)
对字段进行注入
函数形式
|
public static <T> Function<T,Boolean> canInj(Class<T> type, Field field, Depend dependAnnotation) throws NoSuchMethodException
NoSuchMethodExceptionpublic static <T> Consumer<T> doInj(Class<T> type, Field field, Depend dependAnnotation, Supplier<Depend> getter) throws NoSuchMethodException
type - 需要注入的对象的类型field - 字段dependAnnotation - depend注解getter - 获取字段依赖的函数NoSuchMethodExceptionpublic static <T> BiConsumer<T,DependGetter> doInj(Class<T> type, Field field, Depend dependAnnotation, Function<DependGetter,Depend> getter) throws NoSuchMethodException
type - 需要注入的对象的类型field - 字段dependAnnotation - depend注解getter - 获取字段依赖的函数NoSuchMethodExceptionCopyright © 2020. All rights reserved.