@Override public void reset() { getOriginalInstantiationStrategy().reset(); serviceClass = null; }
@Override public void reset() { getOriginalInstantiationStrategy().reset(); serviceClass = null; }
@Override public void setExternalParameters(Map<String, Object> parameters) { getOriginalInstantiationStrategy().setExternalParameters(parameters); } }
@Override public Collection<Module> getModules() { return getOriginalInstantiationStrategy().getModules(); }
@Override public Map<String, Object> getExternalParameters() { return getOriginalInstantiationStrategy().getExternalParameters(); }
@Override public void setExternalParameters(Map<String, Object> parameters) { getOriginalInstantiationStrategy().setExternalParameters(parameters); } }
@Override public Class<?> getGeneratedRulesClass() throws RulesInstantiationException { return getOriginalInstantiationStrategy().getGeneratedRulesClass(); }
@Override public CompiledOpenClass compile() throws RulesInstantiationException { return getOriginalInstantiationStrategy().compile(); }
@Override public Class<?> getGeneratedRulesClass() throws RulesInstantiationException { return getOriginalInstantiationStrategy().getGeneratedRulesClass(); }
@Override public CompiledOpenClass compile() throws RulesInstantiationException { return getOriginalInstantiationStrategy().compile(); }
@Override public Collection<Module> getModules() { return getOriginalInstantiationStrategy().getModules(); }
@Override public Map<String, Object> getExternalParameters() { return getOriginalInstantiationStrategy().getExternalParameters(); }
/** * Gets interface classes what used for proxy construction. * * @return proxy interfaces * @throws Exception */ protected Class<?>[] getProxyInterfaces(Object originalInstance) throws Exception { List<Class<?>> proxyInterfaces = new ArrayList<Class<?>>(); proxyInterfaces.add(getServiceClass()); Class<?> originalServiceClass = getOriginalInstantiationStrategy().getInstanceClass(); for (Class<?> interfaceClass : originalInstance.getClass().getInterfaces()) { if (!interfaceClass.equals(originalServiceClass)) { proxyInterfaces.add(interfaceClass); } } return proxyInterfaces.toArray(new Class<?>[] {}); }
@Override public ClassLoader getClassLoader() throws RulesInstantiationException { try { return getOriginalInstantiationStrategy().getInstanceClass().getClassLoader(); } catch (ClassNotFoundException e) { throw new RulesInstantiationException(e); } }
@Override public ClassLoader getClassLoader() throws RulesInstantiationException { try { return getOriginalInstantiationStrategy().getInstanceClass().getClassLoader(); } catch (ClassNotFoundException e) { throw new RulesInstantiationException(e); } }
@Override public void forcedReset() { reset(); getOriginalInstantiationStrategy().forcedReset(); }
@Override public void forcedReset() { reset(); getOriginalInstantiationStrategy().forcedReset(); }
@Override public final Object instantiate() throws RulesInstantiationException, ClassNotFoundException { try { Object originalInstance = getOriginalInstantiationStrategy().instantiate(); InvocationHandler invocationHandler = makeInvocationHandler(originalInstance); return Proxy.newProxyInstance(getClassLoader(), getProxyInterfaces(originalInstance), invocationHandler); } catch (Exception e) { throw new RulesInstantiationException(e.getMessage(), e); } }
@Override public final Object instantiate() throws RulesInstantiationException, ClassNotFoundException { try { Object originalInstance = getOriginalInstantiationStrategy().instantiate(); InvocationHandler invocationHandler = makeInvocationHandler(originalInstance); return Proxy.newProxyInstance(getClassLoader(), getProxyInterfaces(originalInstance), invocationHandler); } catch (Exception e) { throw new RulesInstantiationException(e.getMessage(), e); } }
/** * Gets enhanced service class. * * @return service class * @throws ClassNotFoundException * @throws InstantiationException */ @Override public final Class<?> getServiceClass() throws ClassNotFoundException { if (serviceClass == null) { try { Class<?> originalServiceClass = getOriginalInstantiationStrategy().getInstanceClass(); serviceClass = decorateServiceClass(originalServiceClass, getClassLoader()); } catch (Exception e) { throw new OpenlNotCheckedException("Failed to enhance service class.", e); } } return serviceClass; }