/** * Swaps the current introduction implementation. * * @param className the class name of the new implementation */ public void swapImplementation(final String className) { if (className == null) { throw new IllegalArgumentException("class name can not be null"); } try { Class newImplClass = ContextClassLoader.loadClass(className); // todo pbly old // impl.getClassLoader() // would // be safer m_container.swapImplementation(newImplClass); } catch (Exception e) { throw new WrappedRuntimeException(e); } }
/** * Invokes an introduced method with the index specified. * * @param methodIndex the method index * @param parameters the parameters for the invocation * @param callingObject a reference to the calling object * @return the result from the invocation */ public Object invokeMixin( final int methodIndex, final Object[] parameters, final Object callingObject) throws Throwable { Object result = null; switch (m_deploymentModel) { case DeploymentModel.PER_JVM: result = m_container.invokeIntroductionPerJvm(methodIndex, parameters); break; case DeploymentModel.PER_CLASS: result = m_container.invokeIntroductionPerClass(callingObject, methodIndex, parameters); break; case DeploymentModel.PER_INSTANCE: result = m_container.invokeIntroductionPerInstance(callingObject, methodIndex, parameters); break; case DeploymentModel.PER_THREAD: result = m_container.invokeIntroductionPerThread(methodIndex, parameters); break; default: throw new RuntimeException( "invalid deployment model: " + m_aspectContext.getDeploymentModel()); } return result; }