/** * <p> * Legacy method. Please use Gateway.createProxy. * </p> * @param classLoader * @param interfacesToImplement * @param objectId * @param gateway * @return * @deprecated */ public static Object getPythonProxyHandler(ClassLoader classLoader, Class[] interfacesToImplement, String objectId, Gateway gateway) { return gateway.createProxy(classLoader, interfacesToImplement, objectId); }
@Override public Object getPythonServerEntryPoint(Gateway gateway, @SuppressWarnings("rawtypes") Class[] interfacesToImplement) { Object proxy = gateway.createProxy(ReflectionUtil.getClassLoader(), interfacesToImplement, Protocol.ENTRY_POINT_OBJECT_ID); return proxy; }
/** * <p> * Assumes that commandPart is <b>not</b> empty. * </p> * * @param commandPart * @return A Python proxy specified in this command part. */ public static Object getPythonProxy(String commandPart, Gateway gateway) { String proxyString = commandPart.substring(1, commandPart.length()); String[] parts = proxyString.split(";"); int length = parts.length; Class<?>[] interfaces = new Class<?>[length - 1]; if (length < 2) { throw new Py4JException("Invalid Python Proxy."); } for (int i = 1; i < length; i++) { try { interfaces[i - 1] = ReflectionUtil.classForName(parts[i]); if (!interfaces[i - 1].isInterface()) { throw new Py4JException( "This class " + parts[i] + " is not an interface and cannot be used as a Python Proxy."); } } catch (ClassNotFoundException e) { throw new Py4JException("Invalid interface name: " + parts[i]); } } return gateway.createProxy(ReflectionUtil.getClassLoader(), interfaces, parts[0]); }