public static <R> Function<Tuple, R> fromTuple() {
    return tuple -> {
      if (tuple.values().size() != 1) {
        throw new IllegalArgumentException(String.format("Expected tuple of size 1 got %d", tuple.values().size()));
      }

      @SuppressWarnings("unchecked")
      R result = (R) tuple.values().get(0);
      return result;
    };
  }
Set of functions to process a {@link Tuple}
criteria/common/src/org/immutables/criteria/repository/Mappers.java