cn.leancloud.EnginePersistence Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloud-function-sdk Show documentation
Show all versions of cloud-function-sdk Show documentation
leancloud leanengine cloud function library
package cn.leancloud;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.internal.impl.SimplePersistence;
public class EnginePersistence extends SimplePersistence {
private ThreadLocal currentUser;
EnginePersistence() {
currentUser = new InheritableThreadLocal<>();
}
@Override
public void setCurrentUser(AVUser user, boolean clean) {
currentUser.set(user);
}
@SuppressWarnings("unchecked")
@Override
public T getCurrentUser(Class userClass) {
return (T) currentUser.get();
}
}