@Test public void getOrCreate() { FactMappingValue simpleFMV = new FactMappingValue(FactIdentifier.INDEX, ExpressionIdentifier.INDEX, "10"); FactMappingValue objectFMV = new FactMappingValue(FactIdentifier.INDEX, ExpressionIdentifier.INDEX, "10"); FactMappingValue mvelFMV = new FactMappingValue(FactIdentifier.INDEX, ExpressionIdentifier.INDEX, MVEL_ESCAPE_SYMBOL + " 10"); FactMappingValue mvelWithSpacesFMV = new FactMappingValue(FactIdentifier.INDEX, ExpressionIdentifier.INDEX, " " + MVEL_ESCAPE_SYMBOL + " 10"); FactMappingValue mvelCollectionExpressionFMV = new FactMappingValue(FactIdentifier.INDEX, ExpressionIdentifier.INDEX, new TextNode(MVEL_ESCAPE_SYMBOL + " 10").textValue()); FactMappingValue mvelCollectionExpressionWithSpacesFMV = new FactMappingValue(FactIdentifier.INDEX, ExpressionIdentifier.INDEX, new TextNode(" " + MVEL_ESCAPE_SYMBOL + " 10").textValue()); FactMappingValue mvelCollectionExpressionWitoutMVELEscapeSymbolFMV = new FactMappingValue(FactIdentifier.INDEX, ExpressionIdentifier.INDEX, new TextNode(" 10").textValue()); ExpressionEvaluatorFactory ruleEvaluatorFactory = ExpressionEvaluatorFactory.create(classLoader, ScenarioSimulationModel.Type.RULE); ExpressionEvaluatorFactory dmnEvaluatorFactory = ExpressionEvaluatorFactory.create(classLoader, ScenarioSimulationModel.Type.DMN); assertTrue(ruleEvaluatorFactory.getOrCreate(simpleFMV) instanceof BaseExpressionEvaluator); assertTrue(ruleEvaluatorFactory.getOrCreate(objectFMV) instanceof BaseExpressionEvaluator); assertTrue(ruleEvaluatorFactory.getOrCreate(mvelFMV) instanceof MVELExpressionEvaluator); assertTrue(ruleEvaluatorFactory.getOrCreate(mvelWithSpacesFMV) instanceof MVELExpressionEvaluator); assertTrue(ruleEvaluatorFactory.getOrCreate(mvelCollectionExpressionFMV) instanceof MVELExpressionEvaluator); assertTrue(ruleEvaluatorFactory.getOrCreate(mvelCollectionExpressionWithSpacesFMV) instanceof MVELExpressionEvaluator); assertTrue(ruleEvaluatorFactory.getOrCreate(mvelCollectionExpressionWitoutMVELEscapeSymbolFMV) instanceof BaseExpressionEvaluator); assertTrue(dmnEvaluatorFactory.getOrCreate(simpleFMV) instanceof DMNFeelExpressionEvaluator); assertTrue(dmnEvaluatorFactory.getOrCreate(objectFMV) instanceof DMNFeelExpressionEvaluator); assertTrue(dmnEvaluatorFactory.getOrCreate(mvelFMV) instanceof DMNFeelExpressionEvaluator); assertTrue(dmnEvaluatorFactory.getOrCreate(mvelWithSpacesFMV) instanceof DMNFeelExpressionEvaluator); assertTrue(dmnEvaluatorFactory.getOrCreate(mvelCollectionExpressionFMV) instanceof DMNFeelExpressionEvaluator); assertTrue(dmnEvaluatorFactory.getOrCreate(mvelCollectionExpressionWithSpacesFMV) instanceof DMNFeelExpressionEvaluator); assertTrue(dmnEvaluatorFactory.getOrCreate(mvelCollectionExpressionWitoutMVELEscapeSymbolFMV) instanceof DMNFeelExpressionEvaluator); }
public ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue) { if (Type.DMN.equals(type)) { return getOrCreateDMNExpressionEvaluator(); } String rawValue = (String) factMappingValue.getRawValue(); if (isAnMVELExpression(rawValue)) { return getOrCreateMVELExpressionEvaluator(); } else { return getOrCreateBaseExpressionEvaluator(); } }
ExpressionEvaluatorFactory { public ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue) { if (Type.DMN.equals(type)) { return getOrCreateDMNExpressionEvaluator(); } String rawValue = (String) factMappingValue.getRawValue(); if (isAnMVELExpression(rawValue)) { return getOrCreateMVELExpressionEvaluator(); } else { return getOrCreateBaseExpressionEvaluator(); } } }
ExpressionEvaluatorFactory { public ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue) { if (Type.DMN.equals(type)) { return getOrCreateDMNExpressionEvaluator(); } String rawValue = (String) factMappingValue.getRawValue(); if (isAnMVELExpression(rawValue)) { return getOrCreateMVELExpressionEvaluator(); } else { return getOrCreateBaseExpressionEvaluator(); } } private  ExpressionEvaluatorFactory(ClassLoader classLoader, Type type); }
ExpressionEvaluatorFactory { public ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue) { if (Type.DMN.equals(type)) { return getOrCreateDMNExpressionEvaluator(); } String rawValue = (String) factMappingValue.getRawValue(); if (isAnMVELExpression(rawValue)) { return getOrCreateMVELExpressionEvaluator(); } else { return getOrCreateBaseExpressionEvaluator(); } } private  ExpressionEvaluatorFactory(ClassLoader classLoader, Type type); static ExpressionEvaluatorFactory create(ClassLoader classLoader, Type type); ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue); }
ExpressionEvaluatorFactory { public ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue) { if (Type.DMN.equals(type)) { return getOrCreateDMNExpressionEvaluator(); } String rawValue = (String) factMappingValue.getRawValue(); if (isAnMVELExpression(rawValue)) { return getOrCreateMVELExpressionEvaluator(); } else { return getOrCreateBaseExpressionEvaluator(); } } private  ExpressionEvaluatorFactory(ClassLoader classLoader, Type type); static ExpressionEvaluatorFactory create(ClassLoader classLoader, Type type); ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue);  }