API Reference
This page summarizes the key classes in Conflux. For the complete documentation, read Conflux Javadoc.
Ctx
Ctx is a singleton enum that serves as the primary access point for the default application-wide context. It also supports managing multiple independent named contexts.
Default Context Operations
put(Key<T>, T value) — store or update a value for a key in the default context
get(Key<T>) — retrieve a value from the default context
contains(Key<?>) — check if a key is present in the default context
remove(Key<?>) — remove a key and its listeners from the default context
clear() — clear all keys and listeners from the default context
addListener(Key<T>, Listener<T>) — register a weakly referenced listener in the default context
removeListener(Key<T>, Listener<T>) — remove a listener from the default context
Managing Multiple Named Contexts
getContext(String name) — retrieve or create a named independent context implementing CtxInterface
contextNames() — returns the set of existing named context keys
Each named context functions independently with its own keys, values, and listeners, allowing isolated storage scopes within the same application.
Key
A strongly typed key used to identify context entries:
name() returns the key name
type() returns the key type
Keys ensure type consistency and prevent accidental type mismatches.
Listener
An interface for receiving notifications on value changes:
Listeners are weakly referenced to avoid memory leaks and invoked whenever the corresponding key's value changes.
Home | Programming Guide | Design and Architecture | FAQ | Contributing