/** * Wraps a method as a JavaScript function. * @param methodName the name of the method to wrap * @param clazz the class declaring the method * @param parameterTypes the types of the method's parameter * @throws NoSuchMethodException if the method is no found */ MethodWrapper(final String methodName, final Class<?> clazz, final Class<?>[] parameterTypes) throws NoSuchMethodException { clazz_ = clazz; method_ = clazz.getMethod(methodName, parameterTypes); jsTypeTags_ = new int[parameterTypes.length]; int i = 0; for (final Class<?> klass : parameterTypes) { jsTypeTags_[i++] = FunctionObject.getTypeTag(klass); } }
/** * Wraps a method as a JavaScript function. * @param methodName the name of the method to wrap * @param clazz the class declaring the method * @param parameterTypes the types of the method's parameter * @throws NoSuchMethodException if the method is no found */ MethodWrapper(final String methodName, final Class< ? > clazz, final Class< ? >[] parameterTypes) throws NoSuchMethodException { clazz_ = clazz; method_ = clazz.getMethod(methodName, parameterTypes); jsTypeTags_ = new int[parameterTypes.length]; int i = 0; for (final Class< ? > klass : parameterTypes) { jsTypeTags_[i++] = FunctionObject.getTypeTag(klass); } }
/** * Wraps a method as a JavaScript function. * @param methodName the name of the method to wrap * @param clazz the class declaring the method * @param parameterTypes the types of the method's parameter * @throws NoSuchMethodException if the method is no found */ MethodWrapper(final String methodName, final Class< ? > clazz, final Class< ? >[] parameterTypes) throws NoSuchMethodException { clazz_ = clazz; method_ = clazz.getMethod(methodName, parameterTypes); jsTypeTags_ = new int[parameterTypes.length]; int i = 0; for (final Class< ? > klass : parameterTypes) { jsTypeTags_[i++] = FunctionObject.getTypeTag(klass); } }
/** * Wraps a method as a JavaScript function. * @param methodName the name of the method to wrap * @param clazz the class declaring the method * @param parameterTypes the types of the method's parameter * @throws NoSuchMethodException if the method is no found */ MethodWrapper(final String methodName, final Class< ? > clazz, final Class< ? >[] parameterTypes) throws NoSuchMethodException { clazz_ = clazz; method_ = clazz.getMethod(methodName, parameterTypes); jsTypeTags_ = new int[parameterTypes.length]; int i = 0; for (final Class< ? > klass : parameterTypes) { jsTypeTags_[i++] = FunctionObject.getTypeTag(klass); } }
/** * Wraps a method as a JavaScript function. * @param methodName the name of the method to wrap * @param clazz the class declaring the method * @param parameterTypes the types of the method's parameter * @throws NoSuchMethodException if the method is no found */ MethodWrapper(final String methodName, final Class<?> clazz, final Class<?>[] parameterTypes) throws NoSuchMethodException { clazz_ = clazz; method_ = clazz.getMethod(methodName, parameterTypes); jsTypeTags_ = new int[parameterTypes.length]; int i = 0; for (final Class<?> klass : parameterTypes) { jsTypeTags_[i++] = FunctionObject.getTypeTag(klass); } }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (parmsLength > 0) { Class<?>[] types = member.argTypes; typeTags = new byte[parmsLength]; for (int i = 0; i != parmsLength; ++i) { typeTags[i] = (byte)getTypeTag(types[i]); } } if (member.isMethod()) { Method method = member.method(); Class<?> returnType = method.getReturnType(); if (returnType == Void.TYPE) { hasVoidReturn = true; } else { returnTypeTag = getTypeTag(returnType); } } }
/** * @deprecated Use {@link #getTypeTag(Class)} * and {@link #convertArg(Context, Scriptable, Object, int)} * for type conversion. */ public static Object convertArg(Context cx, Scriptable scope, Object arg, Class<?> desired) { int tag = getTypeTag(desired); if (tag == JAVA_UNSUPPORTED_TYPE) { throw Context.reportRuntimeError1 ("msg.cant.convert", desired.getName()); } return convertArg(cx, scope, arg, tag); }
typeTags = new byte[arity]; for (int i = 0; i != arity; ++i) { int tag = getTypeTag(types[i]); if (tag == JAVA_UNSUPPORTED_TYPE) { throw Context.reportRuntimeError2( hasVoidReturn = true; } else { returnTypeTag = getTypeTag(returnType);
int tag = FunctionObject.getTypeTag(valueType); Object actualArg = FunctionObject.convertArg(cx, start, value, tag);