public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { assert parameters.size() == 1 : "Unexpectedly got " + parameters.size() + " arguments for fromJson()"; ByteBuffer argument = parameters.get(0); if (argument == null) return null; String jsonArg = UTF8Type.instance.getSerializer().deserialize(argument); try { Object object = Json.JSON_OBJECT_MAPPER.readValue(jsonArg, Object.class); if (object == null) return null; return returnType.fromJSONObject(object).bindAndGet(QueryOptions.forProtocolVersion(protocolVersion)); } catch (IOException exc) { throw new FunctionExecutionException(NAME, Collections.singletonList("text"), String.format("Could not decode JSON string '%s': %s", jsonArg, exc.toString())); } catch (MarshalException exc) { throw FunctionExecutionException.create(this, exc); } } }
public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { assert parameters.size() == 1 : "Unexpectedly got " + parameters.size() + " arguments for fromJson()"; ByteBuffer argument = parameters.get(0); if (argument == null) return null; String jsonArg = UTF8Type.instance.getSerializer().deserialize(argument); try { Object object = Json.JSON_OBJECT_MAPPER.readValue(jsonArg, Object.class); if (object == null) return null; return returnType.fromJSONObject(object).bindAndGet(QueryOptions.forProtocolVersion(protocolVersion)); } catch (IOException exc) { throw new FunctionExecutionException(NAME, Collections.singletonList("text"), String.format("Could not decode JSON string '%s': %s", jsonArg, exc.toString())); } catch (MarshalException exc) { throw FunctionExecutionException.create(this, exc); } } }
public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { assert parameters.size() == 1 : "Unexpectedly got " + parameters.size() + " arguments for fromJson()"; ByteBuffer argument = parameters.get(0); if (argument == null) return null; String jsonArg = UTF8Type.instance.getSerializer().deserialize(argument); try { Object object = Json.JSON_OBJECT_MAPPER.readValue(jsonArg, Object.class); if (object == null) return null; return returnType.fromJSONObject(object).bindAndGet(QueryOptions.forProtocolVersion(protocolVersion)); } catch (IOException exc) { throw new FunctionExecutionException(NAME, Collections.singletonList("text"), String.format("Could not decode JSON string '%s': %s", jsonArg, exc.toString())); } catch (MarshalException exc) { throw FunctionExecutionException.create(this, exc); } } }
public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { assert parameters.size() == 1 : "Unexpectedly got " + parameters.size() + " arguments for fromJson()"; ByteBuffer argument = parameters.get(0); if (argument == null) return null; String jsonArg = UTF8Type.instance.getSerializer().deserialize(argument); try { Object object = Json.JSON_OBJECT_MAPPER.readValue(jsonArg, Object.class); if (object == null) return null; return returnType.fromJSONObject(object).bindAndGet(QueryOptions.forProtocolVersion(protocolVersion)); } catch (IOException exc) { throw new FunctionExecutionException(NAME, Collections.singletonList("text"), String.format("Could not decode JSON string '%s': %s", jsonArg, exc.toString())); } catch (MarshalException exc) { throw FunctionExecutionException.create(this, exc); } } }