@Test public void testCreateArray() { Object array1 = rEngine.createArray("int", new int[] { 2 }); int[] array1int = (int[]) array1; assertEquals(2, array1int.length); array1 = rEngine.createArray("java.lang.String", new int[] { 3, 4 }); String[][] array1String = (String[][]) array1; assertEquals(3, array1String.length); assertEquals(4, array1String[0].length); }
public Object createArray(String fqn, int[] dimensions) { Class<?> clazz = null; Object returnObject = null; try { clazz = TypeUtil.forName(fqn); returnObject = Array.newInstance(clazz, dimensions); } catch (Exception e) { logger.log(Level.WARNING, "Class FQN does not exist: " + fqn, e); throw new Py4JException(e); } return returnObject; }
ReflectionEngine { public Object createArray(String fqn, int[] dimensions) { Class<?> clazz = null; Object returnObject = null; try { clazz = TypeUtil.forName(fqn); returnObject = Array.newInstance(clazz, dimensions); } catch (Exception e) { logger.log(Level.WARNING, "Class FQN does not exist: " + fqn, e); throw new Py4JException(e); } return returnObject; } }
ReflectionEngine { public Object createArray(String fqn, int[] dimensions) { Class<?> clazz = null; Object returnObject = null; try { clazz = TypeUtil.forName(fqn); returnObject = Array.newInstance(clazz, dimensions); } catch (Exception e) { logger.log(Level.WARNING, "Class FQN does not exist: " + fqn, e); throw new Py4JException(e); } return returnObject; }  }
ReflectionEngine { public Object createArray(String fqn, int[] dimensions) { Class<?> clazz = null; Object returnObject = null; try { clazz = TypeUtil.forName(fqn); returnObject = Array.newInstance(clazz, dimensions); } catch (Exception e) { logger.log(Level.WARNING, "Class FQN does not exist: " + fqn, e); throw new Py4JException(e); } return returnObject; }  Object createArray(String fqn, int[] dimensions); Class<?> getClass(Class<?> clazz, String name); Class<?>[] getClassParameters(Object[] parameters); MethodInvoker getConstructor(Class<?> clazz, Class<?>[] parameters); MethodInvoker getConstructor(String classFQN, Object[] parameters); Field getField(Class<?> clazz, String name); Field getField(Object obj, String name); Field getField(String classFQN, String name); Object getFieldValue(Object obj, Field field); Method getMethod(Class<?> clazz, String name); MethodInvoker getMethod(Class<?> clazz, String name, Class<?>[] parameters); MethodInvoker getMethod(Object object, String name, Object[] parameters); MethodInvoker getMethod(String classFQN, String name, Object[] parameters); Object invoke(Object object, MethodInvoker invoker, Object[] parameters); void setFieldValue(Object obj, Field field, Object value); String[] getPublicMethodNames(Object obj); String[] getPublicFieldNames(Object obj); String[] getPublicStaticFieldNames(Class<?> clazz); String[] getPublicStaticMethodNames(Class<?> clazz); String[] getPublicStaticClassNames(Class<?> clazz); String[] getPublicStaticNames(Class<?> clazz); }
ReflectionEngine { public Object createArray(String fqn, int[] dimensions) { Class<?> clazz = null; Object returnObject = null; try { clazz = TypeUtil.forName(fqn); returnObject = Array.newInstance(clazz, dimensions); } catch (Exception e) { logger.log(Level.WARNING, "Class FQN does not exist: " + fqn, e); throw new Py4JException(e); } return returnObject; }  Object createArray(String fqn, int[] dimensions); Class<?> getClass(Class<?> clazz, String name); Class<?>[] getClassParameters(Object[] parameters); MethodInvoker getConstructor(Class<?> clazz, Class<?>[] parameters); MethodInvoker getConstructor(String classFQN, Object[] parameters); Field getField(Class<?> clazz, String name); Field getField(Object obj, String name); Field getField(String classFQN, String name); Object getFieldValue(Object obj, Field field); Method getMethod(Class<?> clazz, String name); MethodInvoker getMethod(Class<?> clazz, String name, Class<?>[] parameters); MethodInvoker getMethod(Object object, String name, Object[] parameters); MethodInvoker getMethod(String classFQN, String name, Object[] parameters); Object invoke(Object object, MethodInvoker invoker, Object[] parameters); void setFieldValue(Object obj, Field field, Object value); String[] getPublicMethodNames(Object obj); String[] getPublicFieldNames(Object obj); String[] getPublicStaticFieldNames(Class<?> clazz); String[] getPublicStaticMethodNames(Class<?> clazz); String[] getPublicStaticClassNames(Class<?> clazz); String[] getPublicStaticNames(Class<?> clazz); final static int cacheSize; final static Object RETURN_VOID; }