KiePMMLTreeModelFactory { public static KiePMMLTreeModel getKiePMMLTreeModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final TreeModel model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap) throws IllegalAccessException, InstantiationException { logger.trace("getKiePMMLTreeModel {}", model); String className = getSanitizedClassName(model.getModelName()); String packageName = getSanitizedPackageName(className); Map<String, String> sourcesMap = getKiePMMLTreeModelSourcesMap(dataDictionary, transformationDictionary, model, fieldTypeMap, packageName); String fullClassName = packageName + "." + className; final Map<String, Class<?>> compiledClasses = KieMemoryCompiler.compile(sourcesMap, Thread.currentThread().getContextClassLoader()); return (KiePMMLTreeModel) compiledClasses.get(fullClassName).newInstance(); } private  KiePMMLTreeModelFactory(); static KiePMMLTreeModel getKiePMMLTreeModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final TreeModel model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap); static Map<String, String> getKiePMMLTreeModelSourcesMap(final DataDictionary dataDictionary,
                                                                    final TransformationDictionary transformationDictionary,
                                                                    final TreeModel model,
                                                                    final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                                    final String packageName); static KiePMMLDroolsAST getKiePMMLDroolsAST(final DataDictionary dataDictionary,
                                                       final TreeModel model,
                                                       final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                       final List<KiePMMLDroolsType> types);  }
@Test public void getKiePMMLTreeModel() throws InstantiationException, IllegalAccessException { final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(pmml.getDataDictionary(), pmml.getTransformationDictionary(), treeModel.getLocalTransformations()); KiePMMLTreeModel retrieved = KiePMMLTreeModelFactory.getKiePMMLTreeModel(pmml.getDataDictionary(),pmml.getTransformationDictionary(), treeModel, fieldTypeMap); assertNotNull(retrieved); assertEquals(treeModel.getModelName(), retrieved.getName()); assertEquals(TARGET_FIELD, retrieved.getTargetField()); }