public Object instantiate(Class clazz, String configuration) { Object newInstance = null; try { // parse the bean configuration Element configurationElement = parseConfiguration(configuration); Constructor constructor = clazz.getDeclaredConstructor( parameterTypes ); constructor.setAccessible(true); newInstance = constructor.newInstance( new Object[] { configurationElement } ); } catch (Exception e) { log.error( "couldn't instantiate '" + clazz.getName() + "'", e ); throw new JbpmException( e ); } return newInstance; }
private static Map createInstantiatorCache() { Map instantiators = new HashMap(); instantiators.put(null, new FieldInstantiator()); instantiators.put("field", new FieldInstantiator()); instantiators.put("bean", new BeanInstantiator()); instantiators.put("constructor", new ConstructorInstantiator()); instantiators.put("configuration-property", new ConfigurationPropertyInstantiator()); instantiators.put("xml", new XmlInstantiator()); return instantiators; }
private static Map createInstantiatorCache() { Map instantiators = new HashMap(); instantiators.put(null, new FieldInstantiator()); instantiators.put("field", new FieldInstantiator()); instantiators.put("bean", new BeanInstantiator()); instantiators.put("constructor", new ConstructorInstantiator()); instantiators.put("configuration-property", new ConfigurationPropertyInstantiator()); instantiators.put("xml", new XmlInstantiator()); return instantiators; }
public Object instantiate(Class clazz, String configuration) { Object newInstance = null; try { // parse the bean configuration Element configurationElement = parseConfiguration(configuration); Constructor constructor = clazz.getDeclaredConstructor( parameterTypes ); constructor.setAccessible(true); newInstance = constructor.newInstance( new Object[] { configurationElement } ); } catch (Exception e) { log.error( "couldn't instantiate '" + clazz.getName() + "'", e ); throw new JbpmException( e ); } return newInstance; }