mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-05-05 13:17:55 +08:00
Session新增getString(key)方法,方便取值时类型转换
This commit is contained in:
parent
5808710bbf
commit
aaf4bb8931
@ -248,6 +248,19 @@ public class SaSession implements Serializable {
|
||||
return getAttribute(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从Session中取值,转化为String类型
|
||||
* @param key key
|
||||
* @return 值
|
||||
*/
|
||||
public String getString(String key) {
|
||||
Object value = getObject(key);
|
||||
if(value == null) {
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个值是否为null
|
||||
* @param value 指定值
|
||||
|
Loading…
Reference in New Issue
Block a user