1 package org.jicengine.operation; 2 3 import java.util.*; 4 5 13 14 public class ObjectInstantiationOperation extends InvocationOperation { 15 16 public ObjectInstantiationOperation(String signature, Operation instantiatedClass, Operation[] parameters) 17 { 18 super(signature, instantiatedClass, parameters); 19 } 20 21 protected Object execute(Object actor, Object [] arguments) throws OperationException 22 { 23 try { 24 return instantiate((Class ) actor, arguments); 25 } catch (RuntimeException e){ 26 throw e; 27 } catch (Exception e){ 28 throw new OperationException(e.toString(), e); 29 } 30 } 31 32 35 private Object instantiate(Class instantiatedClass, Object [] arguments) throws Exception { 36 try { 37 return org.jicengine.operation.ReflectionUtils.instantiate(instantiatedClass, arguments); 38 } catch (java.lang.reflect.InvocationTargetException e){ 39 throw (Exception ) e.getTargetException(); 40 } 41 } 42 43 } 44 | Popular Tags |