Java Utililty Methods Script Binding

List of utility methods to do Script Binding

Description

The list of methods to do Script Binding are organized into topic(s).

Method

TbuildOptions(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()) {
...
BasicDBListconvertArray(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;
DocumentdocumentFromMap(Bindings from)
document From Map
return new Document(from);
HashMapgetBindings(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;
BindingsgetBindings(Map bindings)
get Bindings
return (bindings instanceof Bindings ? (Bindings) bindings : new SimpleBindings(bindings));
Bindingsmerge(Bindings former, Bindings latter)
Combine two bindings objects.
Bindings bindings = new SimpleBindings();
bindings.putAll(former);
bindings.putAll(latter);
return bindings;
voidputSimpleField(String field, Bindings options, BasicDBObjectBuilder command)
put Simple Field
Object val = options.get(field);
if (val != null) {
    command.add(field, val);
BindingstoScriptBindings(Map context)
to Script Bindings
return new SimpleBindings(context);