equal
deleted
inserted
replaced
221 |
221 |
222 return simpleType(typeName); |
222 return simpleType(typeName); |
223 } |
223 } |
224 |
224 |
225 /** |
225 /** |
|
226 * Returns name of a java type {@link StaticClass}. |
|
227 * @param self not used |
|
228 * @param type the type whose name is returned |
|
229 * @return name of the given type |
|
230 */ |
|
231 @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) |
|
232 public static Object typeName(final Object self, final Object type) { |
|
233 if (type instanceof StaticClass) { |
|
234 return ((StaticClass)type).getRepresentedClass().getName(); |
|
235 } else if (type instanceof Class) { |
|
236 return ((Class<?>)type).getName(); |
|
237 } else { |
|
238 return UNDEFINED; |
|
239 } |
|
240 } |
|
241 |
|
242 /** |
226 * Given a JavaScript array and a Java type, returns a Java array with the same initial contents, and with the |
243 * Given a JavaScript array and a Java type, returns a Java array with the same initial contents, and with the |
227 * specified component type. Example: |
244 * specified component type. Example: |
228 * <pre> |
245 * <pre> |
229 * var anArray = [1, "13", false] |
246 * var anArray = [1, "13", false] |
230 * var javaIntArray = Java.toJavaArray(anArray, "int") |
247 * var javaIntArray = Java.toJavaArray(anArray, "int") |