本文整理匯總了Java中java.beans.Introspector.flushFromCaches方法的典型用法代碼示例。如果您正苦於以下問題:Java Introspector.flushFromCaches方法的具體用法?Java Introspector.flushFromCaches怎麽用?Java Introspector.flushFromCaches使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.beans.Introspector
的用法示例。
在下文中一共展示了Introspector.flushFromCaches方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkListeners
import java.beans.Introspector; //導入方法依賴的package包/類
private void checkListeners() {
BeanInfo beanInfo = null;
try {
beanInfo = Introspector.getBeanInfo( getClass(), Object.class );
internalCheckListeners( beanInfo );
}
catch( IntrospectionException t ) {
throw new HibernateException( "Unable to validate listener config", t );
}
finally {
if ( beanInfo != null ) {
// release the jdk internal caches everytime to ensure this
// plays nicely with destroyable class-loaders
Introspector.flushFromCaches( getClass() );
}
}
}
示例2: getBeanInfo
import java.beans.Introspector; //導入方法依賴的package包/類
/**
* @desc 根據對象獲取對象所有屬性、屬性值
*
* @author liuliang
*
* @param entity 對象
* @return Map<String,Object> [key:屬性名 value:屬性名對應的值]
*/
public static Map<String,Object> getBeanInfo(Object entity){
Map<String,Object> map = new HashMap<String, Object>(16);
try {
Class<?> clazz = entity.getClass();
BeanInfo beanInfo = null;
if(null == methodCache.get(clazz)){
Class<?> superClazz =clazz.getSuperclass();
beanInfo = Introspector.getBeanInfo(clazz, superClazz);
methodCache.put(clazz, beanInfo);
Introspector.flushFromCaches(clazz);
if(null != superClazz){
Introspector.flushFromCaches(superClazz);
}
}else{
beanInfo = methodCache.get(clazz);
}
PropertyDescriptor[] pdArr = beanInfo.getPropertyDescriptors();
for(PropertyDescriptor pd:pdArr){
String fieldName = pd.getName();
Object fieldValue = getFieldValue(pd.getReadMethod(),entity);
map.put(fieldName, fieldValue);
}
} catch (IntrospectionException e) {
logger.error("獲取對象信息異常,entity:{}",entity.getClass(),e);
}
return map;
}
示例3: forgetClassLoader
import java.beans.Introspector; //導入方法依賴的package包/類
public void forgetClassLoader(String id, Plugin dInfo) {
if(dInfo == null) {
forgetClassLoader(id);
return;
}
GateClassLoader classloader = null;
synchronized(childClassLoaders) {
classloader = childClassLoaders.remove(id);
}
if(classloader != null && !classloader.isIsolated()) {
// now only remove those classes from the caches that the
// classloader was responsible for
for(ResourceInfo rInfo : dInfo.getResourceInfoList()) {
try {
@SuppressWarnings("unchecked")
Class<? extends Resource> c =
(Class<? extends Resource>)classloader.loadClass(
rInfo.getResourceClassName());
if(c != null) {
// in theory this shouldn't be needed as the Introspector
// uses soft references if we move to requiring Java 8 it
// should be safe to drop this call
Introspector.flushFromCaches(c);
AbstractResource.forgetBeanInfo(c);
}
} catch(ClassNotFoundException e) {
// hmm not sure what to do now
e.printStackTrace();
}
}
}
}