org.babyfish.jimmer.sql.runtime.Cursors Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jimmer-sql Show documentation
Show all versions of jimmer-sql Show documentation
A revolutionary ORM framework for both java and kotlin
package org.babyfish.jimmer.sql.runtime;
public class Cursors {
private static final ThreadLocal CURRENT_ID_LOCAL = new ThreadLocal<>();
private Cursors() {}
public static Long currentCursorId() {
return CURRENT_ID_LOCAL.get();
}
static Long setCurrentCursorId(Long cursorId) {
Long oldValue = CURRENT_ID_LOCAL.get();
if (cursorId != null) {
CURRENT_ID_LOCAL.set(cursorId);
} else {
CURRENT_ID_LOCAL.remove();
}
return oldValue;
}
}