use of de.metas.process.JavaProcess in project metasfresh-webui-api by metasfresh.
the class WebuiProcessClassInfo method retriveLookupValues.
private static final LookupValuesList retriveLookupValues(final Method method, final List<Function<LookupDataSourceContext, Object>> parameterValueProviders, final LookupDataSourceContext evalCtx) {
Check.assumeNotNull(method, "Parameter method is not null");
final JavaProcess processClassInstance = JavaProcess.currentInstance();
final Object[] methodParams = parameterValueProviders.stream().map(paramValueProvider -> paramValueProvider.apply(evalCtx)).toArray();
try {
if (!method.isAccessible()) {
method.setAccessible(true);
}
final LookupValuesList lookupValues = (LookupValuesList) method.invoke(processClassInstance, methodParams);
return lookupValues;
} catch (IllegalAccessException | InvocationTargetException e) {
final Throwable cause = AdempiereException.extractCause(e);
throw new AdempiereException("Failed invoking " + method + " using " + methodParams, cause);
} catch (final Exception e) {
throw AdempiereException.wrapIfNeeded(e);
}
}
Aggregations