List of utility methods to do Nashorn Javascript Library
void | addToArray(final Object array, final Object value) add To Array ((ScriptObjectMirror) array).callMember("push", value);
|
void | addToNativeObject(final Object object, final String key, final Object value) add To Native Object ((ScriptObject) object).put(key, value, false); |
String | decode(final Object self, final String string, final boolean component) decode if (string.isEmpty()) { return string; final int len = string.length(); final StringBuilder sb = new StringBuilder(); for (int k = 0; k < len; k++) { final char ch = string.charAt(k); if (ch != '%') { ... |
String | encode(final Object self, final String string, final boolean component) encode if (string.isEmpty()) { return string; final int len = string.length(); final StringBuilder sb = new StringBuilder(); for (int k = 0; k < len; k++) { final char C = string.charAt(k); if (isUnescaped(C, component)) { ... |
String | error(final String string, final int index) error throw uriError("bad.uri", string, Integer.toString(index)); |
String | escape(Object value) escape if (value == null) { return "NULL"; if (Number.class.isAssignableFrom(value.getClass())) { return value.toString(); if (Boolean.class.isAssignableFrom(value.getClass())) { return (boolean) value ? "1" : "0"; ... |
int | getArrayLength(NativeArray arr) get Array Length Object length = arr.getLength(); if (length instanceof Long) { return ((Long) length).intValue(); } else if (length instanceof Integer) { return (Integer) length; } else { return Integer.parseInt(length.toString()); |
boolean | isArrayType(final Object value) is Array Type return (value instanceof ScriptObjectMirror) && ((ScriptObjectMirror) value).isArray(); |
boolean | isDateType(final ScriptObjectMirror value) is Date Type return "Date".equalsIgnoreCase(value.getClassName()); |
boolean | isNashornScript(final String className) is Nashorn Script return className.startsWith("jdk.nashorn.internal.scripts.Script$"); |