@Ignore("https: @Test public void evaluateLiteralExpression_Array() { assertThat(evaluator.evaluateLiteralExpression(mvelExpression("{\"Jim\", \"Michael\"}"), Object[].class.getCanonicalName(), Collections.emptyList() )) .isEqualTo(new String[]{"Jim", "Michael"}); assertThat(evaluator.evaluateLiteralExpression(mvelExpression("{ }"), Object[].class.getCanonicalName(), Collections.emptyList() )) .isEqualTo(new String[]{}); }
@Override public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses) { Object expressionResult = compileAndExecute(rawExpression, new HashMap<>()); Class<Object> requiredClass = loadClass(className, classLoader); if (expressionResult != null && !requiredClass.isAssignableFrom(expressionResult.getClass())) { throw new IllegalArgumentException("Cannot assign a '" + expressionResult.getClass().getCanonicalName() + "' to '" + requiredClass.getCanonicalName() + "'"); } return expressionResult; }
MVELExpressionEvaluator implements ExpressionEvaluator { @Override public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses) { Object expressionResult = compileAndExecute(rawExpression, new HashMap<>()); Class<Object> requiredClass = loadClass(className, classLoader); if (expressionResult != null && !requiredClass.isAssignableFrom(expressionResult.getClass())) { throw new IllegalArgumentException("Cannot assign a '" + expressionResult.getClass().getCanonicalName() + "' to '" + requiredClass.getCanonicalName() + "'"); } return expressionResult; } }
MVELExpressionEvaluator implements ExpressionEvaluator { @Override public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses) { Object expressionResult = compileAndExecute(rawExpression, new HashMap<>()); Class<Object> requiredClass = loadClass(className, classLoader); if (expressionResult != null && !requiredClass.isAssignableFrom(expressionResult.getClass())) { throw new IllegalArgumentException("Cannot assign a '" + expressionResult.getClass().getCanonicalName() + "' to '" + requiredClass.getCanonicalName() + "'"); } return expressionResult; } MVELExpressionEvaluator(ClassLoader classLoader); }
MVELExpressionEvaluator implements ExpressionEvaluator { @Override public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses) { Object expressionResult = compileAndExecute(rawExpression, new HashMap<>()); Class<Object> requiredClass = loadClass(className, classLoader); if (expressionResult != null && !requiredClass.isAssignableFrom(expressionResult.getClass())) { throw new IllegalArgumentException("Cannot assign a '" + expressionResult.getClass().getCanonicalName() + "' to '" + requiredClass.getCanonicalName() + "'"); } return expressionResult; } MVELExpressionEvaluator(ClassLoader classLoader); @Override boolean evaluateUnaryExpression(String rawExpression, Object resultValue, Class<?> resultClass); @Override Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses); @Override String fromObjectToExpression(Object value); }
MVELExpressionEvaluator implements ExpressionEvaluator { @Override public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses) { Object expressionResult = compileAndExecute(rawExpression, new HashMap<>()); Class<Object> requiredClass = loadClass(className, classLoader); if (expressionResult != null && !requiredClass.isAssignableFrom(expressionResult.getClass())) { throw new IllegalArgumentException("Cannot assign a '" + expressionResult.getClass().getCanonicalName() + "' to '" + requiredClass.getCanonicalName() + "'"); } return expressionResult; } MVELExpressionEvaluator(ClassLoader classLoader); @Override boolean evaluateUnaryExpression(String rawExpression, Object resultValue, Class<?> resultClass); @Override Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses); @Override String fromObjectToExpression(Object value);  }