class DMNScenarioRunnerHelper extends AbstractRunnerHelper {

    @SuppressWarnings("unchecked")
    @Override
    protected Object createObject(ValueWrapper<Object> initialInstance, String className, Map<List<String>, Object> params, ClassLoader classLoader) {
        // simple types
        if (initialInstance.isValid() && !(initialInstance.getValue() instanceof Map)) {
            return initialInstance.getValue();
        }
        Map<String, Object> toReturn = (Map<String, Object>) initialInstance.orElseGet(HashMap::new);
        for (Map.Entry<List<String>, Object> listObjectEntry : params.entrySet()) {

            // direct mapping already considered
            if (listObjectEntry.getKey().isEmpty()) {
                continue;
            }

            List<String> allSteps = listObjectEntry.getKey();
            List<String> steps = allSteps.subList(0, allSteps.size() - 1);
            String lastStep = allSteps.get(allSteps.size() - 1);

            Map<String, Object> targetMap = toReturn;
            for (String step : steps) {
                targetMap = (Map<String, Object>) targetMap.computeIfAbsent(step, k -> new HashMap<>());
            }
            targetMap.put(lastStep, listObjectEntry.getValue());
        }
        return toReturn;
    }

}