List of utility methods to do Script Binding
T | buildOptions(T buildedOptions, Bindings options) build Options Preconditions.checkNotNull(buildedOptions); if (options == null || options.isEmpty()) { return buildedOptions; Map<String, Method> methods = Arrays.stream(buildedOptions.getClass().getMethods()) .filter(m -> !Object.class.equals(m.getDeclaringClass())) .collect(Collectors.toMap(m -> m.getName(), Function.identity())); for (Entry<String, Object> entry : options.entrySet()) { ... |
BasicDBList | convertArray(Bindings from) convert Array BasicDBList list = new BasicDBList(); for (int i = 0; i < from.size(); i++) { list.add(from.get(String.valueOf(i))); return list; |
Document | documentFromMap(Bindings from) document From Map return new Document(from); |
HashMap | getBindings(Bindings bindings) get Bindings HashMap<String, Object> engineScopes = new HashMap<String, Object>(); for (String key : bindings.keySet()) { if (!key.equals(MC_API) && !key.startsWith("__")) { engineScopes.put(key, bindings.get(key)); return engineScopes; |
Bindings | getBindings(Map get Bindings return (bindings instanceof Bindings ? (Bindings) bindings : new SimpleBindings(bindings)); |
Bindings | merge(Bindings former, Bindings latter) Combine two bindings objects. Bindings bindings = new SimpleBindings(); bindings.putAll(former); bindings.putAll(latter); return bindings; |
void | putSimpleField(String field, Bindings options, BasicDBObjectBuilder command) put Simple Field Object val = options.get(field); if (val != null) { command.add(field, val); |
Bindings | toScriptBindings(Map to Script Bindings return new SimpleBindings(context); |