List of usage examples for org.apache.poi.ss.formula.udf AggregatingUDFFinder AggregatingUDFFinder
public AggregatingUDFFinder(UDFFinder... usedToolPacks)
From source file:com.dataart.spreadsheetanalytics.engine.Functions.java
License:Apache License
/** * Does create a new instance of {@link UDFFinder} based on Set of CustomFunction provided. * If you extend {@link Functions} class and replace/add {@link #fs} please also replace/add {@link #poifs}. * UDFFinder instance is needed for some CustomFunction to do evaluation in POI. */// w w w . j a va 2 s .co m protected static UDFFinder loadPoiCustomFunctions(Map<String, Class<? extends ICustomFunction>> fs) { List<String> names = new ArrayList<>(fs.size()); List<ICustomFunction> funcs = new ArrayList<>(fs.size()); for (Entry<String, Class<? extends ICustomFunction>> en : fs.entrySet()) { try { names.add(en.getKey()); funcs.add(en.getValue().newInstance()); } catch (Exception e) { log.error(String.format("Cannot create instance of CustomFunction %s", en.getKey()), e); } } return names.isEmpty() ? null : new AggregatingUDFFinder(new DefaultUDFFinder(names.toArray(new String[names.size()]), funcs.toArray(new ICustomFunction[funcs.size()]))); }
From source file:com.dataart.spreadsheetanalytics.engine.PoiWorkbookConverters.java
License:Apache License
@Override public UDFFinder getUDFFinder() { AggregatingUDFFinder result = new AggregatingUDFFinder(UDFFinder.DEFAULT); result.add(Functions.getUdfFinder()); return result; }
From source file:de.enerko.reports2.engine.ReportEngine.java
License:Apache License
private UDFFinder createCustomFunctions() { UDFFinder rv = null;//from w w w . j av a2 s .c o m if (this.customFunctions.size() > 0) { String[] names = new String[this.customFunctions.size()]; FreeRefFunction[] implementations = new FreeRefFunction[this.customFunctions.size()]; int i = 0; for (Map.Entry<String, FreeRefFunction> entry : this.customFunctions.entrySet()) { names[i] = entry.getKey(); implementations[i] = entry.getValue(); ++i; } rv = new AggregatingUDFFinder(new DefaultUDFFinder(names, implementations)); } return rv; }