1 16 package com.google.gwt.lang; 17 18 import com.google.gwt.core.client.JavaScriptObject; 19 20 22 26 final class Cast { 27 28 protected static Object typeIdArray; 30 31 protected static native boolean canCast(int srcId, int dstId) ; 39 40 static native String charToString(char x) ; 43 44 static native Object dynamicCast(Object src, int dstId) ; 51 52 static native boolean instanceOf(Object src, int dstId) ; 58 59 62 static native byte narrow_byte(Object x) ; 65 66 69 static native char narrow_char(Object x) ; 72 73 76 static native int narrow_int(Object x) ; 79 80 83 static native short narrow_short(Object x) ; 86 87 91 static byte round_byte(Object x) { 92 return narrow_byte(floatToInt(x)); 93 } 94 95 99 static char round_char(Object x) { 100 return narrow_char(floatToInt(x)); 101 } 102 103 106 static native int round_int(Object x) ; 111 112 115 static native long round_long(Object x) ; 120 121 125 static short round_short(Object x) { 126 return narrow_short(floatToInt(x)); 127 } 128 129 133 static Object throwClassCastException() throws ClassCastException { 134 throw new ClassCastException (); 135 } 136 137 141 static Object throwClassCastExceptionUnlessNull(Object o) 142 throws ClassCastException { 143 if (o != null) { 144 throw new ClassCastException (); 145 } 146 return o; 147 } 148 149 static native JavaScriptObject wrapJSO(JavaScriptObject jso, Object seed) ; 170 171 174 private static native Object floatToInt(Object x) ; 179 180 } 181 182 | Popular Tags |