All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.hutool.core.bean.BeanDescCache Maven / Gradle / Ivy

There is a newer version: 5.8.27
Show newest version
package cn.hutool.core.bean;

import cn.hutool.core.lang.SimpleCache;

/**
 * Bean属性缓存
* 缓存用于防止多次反射造成的性能问题 * @author Looly * */ public enum BeanDescCache { INSTANCE; private SimpleCache, BeanDesc> bdCache = new SimpleCache<>(); /** * 获得属性名和{@link BeanDesc}Map映射 * @param beanClass Bean的类 * @return 属性名和{@link BeanDesc}映射 */ public BeanDesc getBeanDesc(Class beanClass){ return bdCache.get(beanClass); } /** * 加入缓存 * @param beanClass Bean的类 * @param BeanDesc 属性名和{@link BeanDesc}映射 */ public void putBeanDesc(Class beanClass, BeanDesc BeanDesc){ bdCache.put(beanClass, BeanDesc); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy