/** Return 0 for no match. */
 public int inputMatch(Class<?> in) {
   if (consume == in) {
     return priority > 0 ? priority : EXACT_MATCH_PRIORITY;
   }
   if (consume.isAssignableFrom(in)) {
     return priority > 0 ? priority : ISTANCE_OF_PRIORITY;
   }
   if (op.getService().isTypeAdaptable(in, consume)) {
     return priority > 0 ? priority : ADAPTABLE_PRIORITY;
   }
   if (consume == Void.TYPE) {
     return priority > 0 ? priority : VOID_PRIORITY;
   }
   return 0;
 }
 protected Object doInvoke(OperationContext ctx, Map<String, Object> args, Object input)
     throws Exception {
   Object target = op.newInstance(ctx, args);
   if (consume == Void.TYPE) {
     // preserve last output for void methods
     Object out = method.invoke(target);
     return produce == Void.TYPE ? input : out;
   } else {
     if (input != null && !consume.isAssignableFrom(input.getClass())) {
       // try to adapt
       input = op.getService().getAdaptedValue(ctx, input, consume);
     }
     return method.invoke(target, input);
   }
 }