FAQ
What happens if I store a null value?
Null values are stored normally. Listeners will be notified if the null differs from the previous value.
Can a listener remove itself?
Yes, a listener can call Ctx.INSTANCE.removeListener(...) on itself if needed.
What if a listener throws an exception?
Exceptions thrown in one listener will not stop other listeners from being notified, but you should handle exceptions inside the listener code.
Can I use primitive types?
Yes, via their boxed equivalents, e.g. Integer, Double, etc.
How about arrays?
Yes, arrays are supported and compared using Objects.deepEquals.
How to test with mocks?
Use a mock of the Listener interface. The key-based typing makes it easy to isolate in unit tests.
How do I use multiple independent contexts?
Use Ctx.INSTANCE.getContext("contextName") to obtain a named context, which behaves like a separate key-value store with its own listeners. This allows modular and isolated state management within the same application.
Home | Programming Guide | API Reference | Design and Architecture | Contributing