Java Code Examples for jdk.nashorn.internal.runtime.JSType#toCharSequence()
The following examples show how to use
jdk.nashorn.internal.runtime.JSType#toCharSequence() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeString.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final Object key) { final CharSequence cs = JSType.toCharSequence(self); final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = ArrayIndex.getArrayIndex(primitiveKey); if (index >= 0 && index < cs.length()) { return String.valueOf(cs.charAt(index)); } return ((ScriptObject) Global.toObject(self)).get(primitiveKey); }
Example 2
Source File: NativeString.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final Object key) { final CharSequence cs = JSType.toCharSequence(self); final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = ArrayIndex.getArrayIndex(primitiveKey); if (index >= 0 && index < cs.length()) { return String.valueOf(cs.charAt(index)); } return ((ScriptObject) Global.toObject(self)).get(primitiveKey); }
Example 3
Source File: NativeString.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static Object get(final Object self, final int key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt(key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 4
Source File: NativeString.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static Object get(final Object self, final int key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt(key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 5
Source File: NativeString.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final Object key) { final CharSequence cs = JSType.toCharSequence(self); final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = ArrayIndex.getArrayIndex(primitiveKey); if (index >= 0 && index < cs.length()) { return String.valueOf(cs.charAt(index)); } return ((ScriptObject) Global.toObject(self)).get(primitiveKey); }
Example 6
Source File: NativeString.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static Object get(final Object self, final int key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt(key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 7
Source File: NativeString.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final long key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt((int)key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 8
Source File: NativeString.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final Object key) { final CharSequence cs = JSType.toCharSequence(self); final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = ArrayIndex.getArrayIndex(primitiveKey); if (index >= 0 && index < cs.length()) { return String.valueOf(cs.charAt(index)); } return ((ScriptObject) Global.toObject(self)).get(primitiveKey); }
Example 9
Source File: NativeString.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static Object get(final Object self, final int key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt(key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 10
Source File: NativeString.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final Object key) { final CharSequence cs = JSType.toCharSequence(self); final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = ArrayIndex.getArrayIndex(primitiveKey); if (index >= 0 && index < cs.length()) { return String.valueOf(cs.charAt(index)); } return ((ScriptObject) Global.toObject(self)).get(primitiveKey); }
Example 11
Source File: NativeString.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final Object key) { final CharSequence cs = JSType.toCharSequence(self); final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = ArrayIndex.getArrayIndex(primitiveKey); if (index >= 0 && index < cs.length()) { return String.valueOf(cs.charAt(index)); } return ((ScriptObject) Global.toObject(self)).get(primitiveKey); }
Example 12
Source File: NativeString.java From nashorn with GNU General Public License v2.0 | 5 votes |
private static Object get(final Object self, final int key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt(key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 13
Source File: NativeString.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final long key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt((int)key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 14
Source File: NativeString.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static Object get(final Object self, final int key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt(key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 15
Source File: NativeString.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object get(final Object self, final long key) { final CharSequence cs = JSType.toCharSequence(self); if (key >= 0 && key < cs.length()) { return String.valueOf(cs.charAt((int)key)); } return ((ScriptObject) Global.toObject(self)).get(key); }
Example 16
Source File: NativeString.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * ECMA 15.5.2.1 new String ( [ value ] ) - special version with one arg * * Constructor * * @param newObj is this constructor invoked with the new operator * @param self self reference * @param arg argument * * @return new NativeString (arg) */ @SpecializedConstructor public static Object constructor(final boolean newObj, final Object self, final Object arg) { final CharSequence str = JSType.toCharSequence(arg); return newObj ? newObj(self, str) : str.toString(); }
Example 17
Source File: NativeString.java From jdk8u_nashorn with GNU General Public License v2.0 | 2 votes |
/** * ECMA 15.5.2.1 new String ( [ value ] ) - special version with one arg * * Constructor * * @param newObj is this constructor invoked with the new operator * @param self self reference * @param arg argument * * @return new NativeString (arg) */ @SpecializedFunction(isConstructor=true) public static Object constructor(final boolean newObj, final Object self, final Object arg) { final CharSequence str = JSType.toCharSequence(arg); return newObj ? newObj(str) : str.toString(); }
Example 18
Source File: NativeString.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * ECMA 15.5.2.1 new String ( [ value ] ) * * Constructor * * @param newObj is this constructor invoked with the new operator * @param self self reference * @param args arguments (a value) * * @return new NativeString, empty string if no args, extraneous args ignored */ @Constructor(arity = 1) public static Object constructor(final boolean newObj, final Object self, final Object... args) { final CharSequence str = (args.length > 0) ? JSType.toCharSequence(args[0]) : ""; return newObj ? newObj(self, str) : str.toString(); }
Example 19
Source File: NativeString.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * ECMA 15.5.2.1 new String ( [ value ] ) - special version with one arg * * Constructor * * @param newObj is this constructor invoked with the new operator * @param self self reference * @param arg argument * * @return new NativeString (arg) */ @SpecializedFunction(isConstructor=true) public static Object constructor(final boolean newObj, final Object self, final Object arg) { final CharSequence str = JSType.toCharSequence(arg); return newObj ? newObj(str) : str.toString(); }
Example 20
Source File: NativeString.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 2 votes |
/** * ECMA 15.5.2.1 new String ( [ value ] ) * * Constructor * * @param newObj is this constructor invoked with the new operator * @param self self reference * @param args arguments (a value) * * @return new NativeString, empty string if no args, extraneous args ignored */ @Constructor(arity = 1) public static Object constructor(final boolean newObj, final Object self, final Object... args) { final CharSequence str = args.length > 0 ? JSType.toCharSequence(args[0]) : ""; return newObj ? newObj(str) : str.toString(); }