InteractionContext

Provides the user and scenario specific environment for an Interaction .

API

InteractionContext.java
class InteractionContext {
  InteractionContext ofUserWithSystemDefaults(final UserMemento user)     (1)
  UnaryOperator<InteractionContext> switchUser(final UserMemento userMemento)     (2)
  UnaryOperator<InteractionContext> switchClock(final VirtualClock clock)     (3)
  UnaryOperator<InteractionContext> switchLocale(final Locale locale)     (4)
  UnaryOperator<InteractionContext> switchTimeZone(final TimeZone timeZone)     (5)
  UnaryOperator<T> combine(final UnaryOperator<T>... mappers)     (6)
  UnaryOperator<T> combine(final Stream<UnaryOperator<T>> mappers)     (7)
  void replaceUser(final UserMemento user)     (8)
}
1 ofUserWithSystemDefaults(UserMemento)

Creates a new InteractionContext with the specified user and system defaults for clock, locale and time-zone.

2 switchUser(UserMemento)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified UserMemento .

3 switchClock(VirtualClock)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified VirtualClock .

4 switchLocale(Locale)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified Locale .

5 switchTimeZone(TimeZone)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified TimeZone .

6 combine(UnaryOperator)

Convenience method to combine UnaryOperator s, for example as per #switchUser(UserMemento) and #switchTimeZone(TimeZone) .

7 combine(Stream)

Convenience method to combine UnaryOperator s, for example as per #switchUser(UserMemento) and #switchTimeZone(TimeZone) . credit: https://stackoverflow.com/a/51065029/56880

8 replaceUser(UserMemento)

For internal usage, not API.

Members

ofUserWithSystemDefaults(UserMemento)

Creates a new InteractionContext with the specified user and system defaults for clock, locale and time-zone.

switchUser(UserMemento)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified UserMemento .

switchClock(VirtualClock)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified VirtualClock .

switchLocale(Locale)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified Locale .

switchTimeZone(TimeZone)

Convenience method for use with org.apache.isis.applib.services.sudo.SudoService , returning a UnaryOperator that will act upon the provided InteractionContext to return the same but with the specified TimeZone .

combine(UnaryOperator)

Convenience method to combine UnaryOperator s, for example as per #switchUser(UserMemento) and #switchTimeZone(TimeZone) .

this implementation can result in heap pollution; better to use the #combine(Stream) overload .

combine(Stream)

Convenience method to combine UnaryOperator s, for example as per #switchUser(UserMemento) and #switchTimeZone(TimeZone) . credit: https://stackoverflow.com/a/51065029/56880

replaceUser(UserMemento)

For internal usage, not API.

Instead, use #withUser(UserMemento) , which honours the value semantics of this class.