return session;
}
private boolean processSession(Object bean, LocalSession localSession)
{
ServerSession serverSession = localSession.getServerSession();
boolean result = false;
for (Class<?> c = bean.getClass(); c != Object.class; c = c.getSuperclass())
{
Field[] fields = c.getDeclaredFields();
for (Field field : fields)
{
if (field.getAnnotation(Session.class) != null)
{
Object value = null;
if (field.getType().isAssignableFrom(localSession.getClass()))
value = localSession;
else if (field.getType().isAssignableFrom(serverSession.getClass()))
value = serverSession;
if (value != null)
{
setField(bean, field, value);
result = true;
if (logger.isDebugEnabled())
logger.debug("Injected {} to field {} on bean {}", value, field, bean);
}
}
}
Method[] methods = c.getDeclaredMethods();
for (Method method : methods)
{
if (method.getAnnotation(Session.class) != null)
{
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length == 1)
{
Object value = null;
if (parameterTypes[0].isAssignableFrom(localSession.getClass()))
value = localSession;
else if (parameterTypes[0].isAssignableFrom(serverSession.getClass()))
value = serverSession;
if (value != null)
{
invokePrivate(bean, method, value);