com.jn.sqlhelper.common.resultset.CachedEntityBeanClassParser Maven / Gradle / Ivy
package com.jn.sqlhelper.common.resultset;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class CachedEntityBeanClassParser extends EntityBeanClassParser {
private static final CachedEntityBeanClassParser instance = new CachedEntityBeanClassParser();
private ConcurrentHashMap> cache = new ConcurrentHashMap>();
private CachedEntityBeanClassParser() {
}
public static CachedEntityBeanClassParser getInstance() {
return instance;
}
@Override
public Map parse(Class clazz) {
if (cache.containsKey(clazz)) {
return cache.get(clazz);
}
Map entityFieldInfoMap = super.parse(clazz);
cache.putIfAbsent(clazz, entityFieldInfoMap);
return entityFieldInfoMap;
}
}