MCPcopy Create free account
hub / github.com/BaseXdb/basex / bind

Method bind

basex-api/src/main/java/org/basex/http/ws/WsFunction.java:90–106  ·  view source on GitHub ↗

Binds the function parameters. @param msg message (can be null; otherwise string or byte array) @param values header values @param qc query context @return arguments @throws QueryException query exception

(final Object msg, final Map<String, Value> values,
      final QueryContext qc)

Source from the content-addressed store, hash-verified

88 * @throws QueryException query exception
89 */
90 Expr[] bind(final Object msg, final Map<String, Value> values,
91 final QueryContext qc) throws QueryException {
92
93 final Expr[] args = new Expr[function.arity()];
94 if(msg != null) values.put("message", msg instanceof final byte[] bytes ? B64.get(bytes) :
95 Str.get((String) msg));
96
97 for(final WebParam param : headerParams) {
98 final Value v = values.get(param.name());
99 bind(param.var(), args, v == null || v.isEmpty() ? param.value() : v, qc,
100 "Value of '" + param.name() + "'");
101 }
102 if(message != null) {
103 bind(message.var(), args, values.get(message.name()), qc, "Message");
104 }
105 return args;
106 }
107
108 /**
109 * Checks if an WebSocket request matches this annotation and path.

Callers 1

initMethod · 0.45

Calls 9

getMethod · 0.95
getMethod · 0.95
isEmptyMethod · 0.95
varMethod · 0.80
arityMethod · 0.65
getMethod · 0.65
nameMethod · 0.65
putMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected