first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package net.sf.jasperreports.engine.fill;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.sf.jasperreports.engine.JRRuntimeException;
|
||||
|
||||
public class JRIncrementerFactoryCache {
|
||||
private static Map factoriesMap = null;
|
||||
|
||||
public static synchronized JRIncrementerFactory getInstance(Class factoryClass) {
|
||||
if (factoriesMap == null)
|
||||
factoriesMap = new HashMap();
|
||||
JRIncrementerFactory incrementerFactory = (JRIncrementerFactory)factoriesMap.get(factoryClass.getName());
|
||||
if (incrementerFactory == null) {
|
||||
try {
|
||||
incrementerFactory = factoryClass.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new JRRuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new JRRuntimeException(e);
|
||||
}
|
||||
factoriesMap.put(factoryClass.getName(), incrementerFactory);
|
||||
}
|
||||
return incrementerFactory;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user