- /** helper that converts a String to a short according to JavaScript coercion rules */
- public static short stosh(Object o) {
- if (o == null) return 0;
- if (o instanceof Number) return ((Number)o).shortValue();
-
- String s;
- if (!(o instanceof String)) s = o.toString();
- else s = (String)o;
-
- try { return Short.parseShort(s.indexOf('.') == -1 ? s : s.substring(0, s.indexOf('.'))); }
- catch (NumberFormatException e) { return 0; }
- }
-
- /** helper that converts a String to a short according to JavaScript coercion rules */
- private static class Apply extends JSObject.JSFunction {
+ /** helper that converts a String to a int according to JavaScript coercion rules */
+ public static class Apply extends JS.Callable {