Can someone tell why the data converter does not work at all and what is the
reason we make the data converter to value assignment statement only? 

  public void testDataConverter() throws Exception {
    OptimizerFactory.setDefaultOptimizer(OptimizerFactory.SAFE_REFLECTIVE);

    DataConversion.addConversionHandler(Date.class, new MyDateConverter());

    Locale.setDefault(Locale.US);

    Cheese cheese = new Cheese();
    cheese.setUseBy(new
SimpleDateFormat("dd-MMM-yyyy").parse("10-Jul-1974"));

    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("cheese", cheese);

    Serializable compiledExpression = MVEL.compileExpression("cheese.useBy
== '10-Jul-1974'");
    boolean result = MVEL.executeExpression(compiledExpression, variables,
Boolean.class);
    assertTrue(result);
  }


Here is what I can see from the code, at the end this method will be called,
would it be nice to allow the data converter here? 
    private static Boolean safeEquals(final Object val1, final Object val2)
{
        if (val1 != null) {
            return val1.equals(val2) ? Boolean.TRUE : Boolean.FALSE;
        }
        else return val2 == null || (val2.equals(val1) ? Boolean.TRUE :
Boolean.FALSE);
    }




-----
Ivan, your Panda, forever
--
View this message in context: 
http://drools.46999.n3.nabble.com/MVEL-the-data-converter-does-not-work-tp3581797p3581797.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to