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

Method assign

basex-api/src/main/java/org/basex/http/rest/RESTCmd.java:138–154  ·  view source on GitHub ↗

Assigns an option. @param options options @param entry current parameter @param enforce force assignment @return success flag @throws HTTPException HTTP exception

(final Options options, final Entry<String, String[]> entry,
      final boolean enforce)

Source from the content-addressed store, hash-verified

136 * @throws HTTPException HTTP exception
137 */
138 static boolean assign(final Options options, final Entry<String, String[]> entry,
139 final boolean enforce) throws HTTPException {
140
141 String key = entry.getKey();
142 if(options instanceof MainOptions) key = key.toUpperCase(Locale.ENGLISH);
143 if(options.option(key) == null) {
144 if(enforce) throw HTTPStatus.UNKNOWN_PARAM_X.get(key);
145 return false;
146 }
147
148 try {
149 options.assign(key, entry.getValue()[0]);
150 return true;
151 } catch(final BaseXException ex) {
152 throw HTTPStatus.BAD_REQUEST_X.get(ex);
153 }
154 }
155}

Callers 7

getMethod · 0.95
assignOptionsMethod · 0.95
parseAnnotationsMethod · 0.45
parseMethod · 0.45
getMethod · 0.45
getMethod · 0.45
createMethod · 0.45

Calls 4

getKeyMethod · 0.80
getMethod · 0.65
optionMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected