public ByteBuffer compute(ResultSetBuilder rs) throws InvalidRequestException { List<ByteBuffer> args = new ArrayList<ByteBuffer>(argSelectors.size()); for (Selector s : argSelectors) args.add(s.compute(rs)); return fun.execute(args); }
private static ByteBuffer executeInternal(Function fun, List<ByteBuffer> params) throws InvalidRequestException { ByteBuffer result = fun.execute(params); try { // Check the method didn't lied on it's declared return type if (result != null) fun.returnType().validate(result); return result; } catch (MarshalException e) { throw new RuntimeException(String.format("Return of function %s (%s) is not a valid value for its declared return type %s", fun, ByteBufferUtil.bytesToHex(result), fun.returnType().asCQL3Type())); } }