Research Article
MCAF: Developing an Annotation-Based Offloading Framework for Mobile Cloud Computing
Algorithm 5
The Cloud server executes the “Add” method in the AddClass.Class through the Java reflection scheme.
(1) | Object[] parameters = new Object[]{x, y}; | (2) | Class[] parametersType = new Class[]{int.class, int.class}; | (3) | Object[] parameters = (Object[]) entityBean.parametersValue.toArray(); | (4) | Class[] parametersType = entityBean.parametersType.toArray(new Class[entityBean.parametersType.size()]); | (5) | Class<?> cl = Class.forName(“org.demo.data.AddClass”); | (6) | Method method = cl.getDeclaredMethod(“add,” parametersType); | (7) | Object object = cl.newInstance(); | (8) | ret = (int) method.invoke(object, parameters); |
|