AnsweredAssumed Answered

Possible bug in REST APIs RestResponseFactory

Question asked by franck102 on Jan 23, 2014
Latest reply on Jan 27, 2014 by frederikheremans1
Shouldn't the isAssignableFrom call below be written the other way around?

org.activiti.rest.service.api.RestResponseFactory#createRestVariable:


     for (RestVariableConverter c : variableConverters) {
        if (value.getClass().isAssignableFrom(c.getVariableType())) {
          converter = c;
          break;
        }
      }
     
      if (converter != null) {
        converter.convertVariableValue(value, restVar);


A converter can convert a subtype into the base type it supports, but not the reverse.
Currently a converter such that converter.getVariableType() == "Cat" will be asked to convert an "Animal" to a "Cat"… that doesn't seem right?



Outcomes