site.sorghum.anno._common.AnnoBeanUtils Maven / Gradle / Ivy
The newest version!
package site.sorghum.anno._common;
import site.sorghum.anno._metadata.MetadataManager;
import java.util.ArrayList;
import java.util.List;
/**
* @author songyinyin
* @since 2023/7/30 15:45
*/
public class AnnoBeanUtils {
private static AnnoBean annoBean;
public static void setBean(AnnoBean annoBean) {
AnnoBeanUtils.annoBean = annoBean;
}
public static T getBean(String name) {
return annoBean.getBean(name);
}
public static T getBean(Class type) {
return annoBean.getBean(type);
}
public static List getBeansOfType(Class type) {
List beans = annoBean.getBeansOfType(type);
// 如果不是ArrayList 则改为ArrayList
if (!(beans instanceof ArrayList)) {
beans = new ArrayList<>(beans);
}
return beans;
}
public static MetadataManager metadataManager() {
return annoBean.getBean(MetadataManager.class);
}
public static String getBeanName(Class> aClass) {
return annoBean.getBeanName(aClass);
}
public static void registerBean(String name, Object bean) {
annoBean.registerBean(name, bean);
}
public static void unregisterBean(String name) {
annoBean.unregisterBean(name);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy