/** * Not intended for public use. Callers should use the * public API Context.toType. * @deprecated as of 1.5 Release 4 * @see net.sourceforge.htmlunit.corejs.javascript.Context#jsToJava(Object, Class) */ public static Object coerceType(Class<?> type, Object value) { return coerceTypeImpl(type, value); }
/** * Convert a JavaScript value into the desired type. * Uses the semantics defined with LiveConnect3 and throws an * Illegal argument exception if the conversion cannot be performed. * @param value the JavaScript value to convert * @param desiredType the Java type to convert to. Primitive Java * types are represented using the TYPE fields in the corresponding * wrapper class in java.lang. * @return the converted value * @throws EvaluatorException if the conversion cannot be performed */ public static Object jsToJava(Object value, Class<?> desiredType) throws EvaluatorException { return NativeJavaObject.coerceTypeImpl(desiredType, value); }