Class CurrentUser
java.lang.Object
com.github.marschall.memoryfilesystem.CurrentUser
Provides access to the current user.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for a task during which a certain user should be used.static interfaceFunctional interface for a task during which a certain user should be used. -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> VuseDuring(UserPrincipal user, CurrentUser.UserTask<V> task) Sets the current user for a certain period.static voiduseDuring(UserPrincipal user, CurrentUser.VoidUserTask task) Sets the current user for a certain period.
-
Method Details
-
useDuring
Sets the current user for a certain period.- Type Parameters:
V- the type of the return value- Parameters:
user- the user to usetask- during this task the given user will be used, will be called immediately by the current thread- Returns:
- what the task returned
- Throws:
IOException- if any of the code in the task throws anIOException
-
useDuring
Sets the current user for a certain period.- Parameters:
user- the user to usetask- during this task the given user will be used, will be called immediately by the current thread- Throws:
IOException- if any of the code in the task throws anIOException- Since:
- 2.4.0
-