Ejemplo n.º 1
0
  @Override
  @SuppressWarnings({"unchecked"})
  protected void resetJavaType(Class targetType) {
    super.resetJavaType(targetType);
    ValueHandlerFactory.ValueHandler valueHandler = getValueHandler();
    if (valueHandler == null) {
      valueHandler = ValueHandlerFactory.determineAppropriateHandler(targetType);
      forceConversion(valueHandler);
    }

    if (valueHandler != null) {
      literal = valueHandler.convert(literal);
    }
  }
    @Override
    public Object transformTuple(Object[] tuple, String[] aliases) {
      final Object[] valueHandlerResult;
      if (valueHandlers == null) {
        valueHandlerResult = tuple;
      } else {
        valueHandlerResult = new Object[tuple.length];
        for (int i = 0; i < tuple.length; i++) {
          ValueHandlerFactory.ValueHandler valueHandler = valueHandlers.get(i);
          valueHandlerResult[i] = valueHandler == null ? tuple[i] : valueHandler.convert(tuple[i]);
        }
      }

      return tupleElements == null
          ? valueHandlerResult.length == 1 ? valueHandlerResult[0] : valueHandlerResult
          : new TupleImpl(tuple);
    }