public static <T> T newInstance(Constructor<T> constructor, Object[] args) { return newInstance(null, constructor, args); }
public static <T> T newInstance(Constructor<T> constructor, Object[] args) { return newInstance(null, constructor, args); }
public static <T> T newInstance(Constructor<T> constructor) { return newInstance(null, constructor, null); }
public static <T> T newInstance(Class<T> clazz) { return newInstance(clazz, null, null); }
public static <T> T newInstance(Constructor<T> constructor) { return newInstance(null, constructor, null); }
public static <T> T newInstance(Class<T> clazz) { return newInstance(clazz, null, null); }
private static void addInterceptor(final Configuration configuration) { final String interceptorClassName = configuration.getProperty("bonita.hibernate.interceptor"); if (interceptorClassName != null) { if (LOG.isLoggable(Level.INFO)) { LOG.info("Adding interceptor: " + interceptorClassName); } final Class<?> interceptorClass = ReflectUtil.loadClass(Thread.currentThread().getContextClassLoader(), interceptorClassName); final EmptyInterceptor interceptor = (EmptyInterceptor) ReflectUtil.newInstance(interceptorClass); configuration.setInterceptor(interceptor); } }
@Override public Object construct(final WireContext wireContext) { // instantiation of the configuration Configuration configuration = null; if (className != null) { final ClassLoader classLoader = wireContext.getClassLoader(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("instantiating hibernate configation class " + className); } final Class<?> configurationClass = ReflectUtil.loadClass(classLoader, className); configuration = (Configuration) ReflectUtil.newInstance(configurationClass); } else { if (LOG.isLoggable(Level.FINE)) { LOG.fine("instantiating default hibernate configation"); } configuration = new Configuration(); } return configuration; }
private Object getClassInstance(final Class<?> clazz) { final Object obj = ReflectUtil.newInstance(clazz); if (obj == null) { final String message = ExceptionManager.getInstance().getFullMessage("be_CDL_2", clazz.getName()); throw new BonitaRuntimeException(message); } return obj; }
public synchronized void startMatcher() { if (!isMatcherActive()) { if (LOG.isLoggable(Level.INFO)) { LOG.info("Starting matcher of message correlation based on correlation keys/no expression '" + name + "'..."); } final Class<EventMatcher> eventMatcherClass = (Class<EventMatcher>) ReflectUtil.loadClass(Thread.currentThread() .getContextClassLoader(), eventMatcherClassName); final Constructor<EventMatcher> constructor = ReflectUtil.getConstructor(eventMatcherClass, new Class[] { EventExecutor.class, String.class }); eventMatcher = ReflectUtil.newInstance(constructor, new Object[] { this, eventMatcherClassName + "-" + Misc.getHostName() + "-" + domain }); eventMatcher.setMaxCouples(matcherMaxCouples); eventMatcher.setMatchingConditionMatcher(expressionMatcherEnable); eventMatcher.start(); } }
final Constructor<JobExecutor> jobExecutorConstructor = ReflectUtil.getConstructor(jobExecutorClass, new Class[] { EventExecutor.class, String.class, int.class, int.class, int.class }); jobExecutor = ReflectUtil.newInstance(jobExecutorConstructor, new Object[] { this, jobExecutorClass.getSimpleName() + "-" + Misc.getHostName() + "-" + domain, nbrOfThreads, locksToQuery, lockIdleTime }); final Constructor<MasterChecker> masterCheckerConstructor = ReflectUtil.getConstructor(masterCheckerClass, new Class[] { EventExecutor.class, String.class }); masterChecker = ReflectUtil.newInstance(masterCheckerConstructor, new Object[] { this, masterCheckerClass.getSimpleName() + "-" + Misc.getHostName() + "-" + domain }); masterChecker.setEnable(masterCheckerEnable);