Session.getAttribute returns generic type
This prevents the need to cast the attribute values. Fixes: gh-64
This commit is contained in:
@@ -63,7 +63,7 @@ public class UserAccountsFilter implements Filter {
|
||||
continue;
|
||||
}
|
||||
|
||||
String username = (String) session.getAttribute("username");
|
||||
String username = session.getAttribute("username");
|
||||
if(username == null) {
|
||||
newSessionAlias = alias;
|
||||
continue;
|
||||
|
||||
@@ -38,8 +38,9 @@ public interface Session {
|
||||
*
|
||||
* @param attributeName the name of the attribute to get
|
||||
* @return the Object associated with the specified name or null if no Object is associated to that name
|
||||
* @param <T> The return type of the attribute
|
||||
*/
|
||||
Object getAttribute(String attributeName);
|
||||
<T> T getAttribute(String attributeName);
|
||||
|
||||
/**
|
||||
* Gets the attribute names that have a value associated with it. Each value can be passed into {@link org.springframework.session.Session#getAttribute(String)} to obtain the attribute value.
|
||||
|
||||
@@ -121,7 +121,7 @@ import org.springframework.session.Session;
|
||||
* continue;
|
||||
* }
|
||||
*
|
||||
* String username = (String) session.getAttribute("username");
|
||||
* String username = session.getAttribute("username");
|
||||
* if(username == null) {
|
||||
* newSessionAlias = alias;
|
||||
* continue;
|
||||
|
||||
Reference in New Issue
Block a user