// Cast
String errorMessage = "Specified factory " + factory.getClass().getName() + " is not of type "
+ StatefulProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName();
assert factory instanceof StatefulProxyFactory : errorMessage;
StatefulProxyFactory statefulFactory = null;
try
{
statefulFactory = (StatefulProxyFactory) factory;
}
catch (ClassCastException cce)
{
throw new ClassCastException(errorMessage);
}
Class<?>[] initParameterTypes =
{};
Object[] initParameterValues =
{};
if (unadvisedMethod.getParameterTypes().length > 0)
{
initParameterTypes = unadvisedMethod.getParameterTypes();
initParameterValues = args;
}
Object id = createSession(initParameterTypes, initParameterValues);
Object proxy = statefulFactory.createProxyBusiness(id, unadvisedMethod.getReturnType().getName());
return proxy;
}