diff --git a/API-Reference.md b/API-Reference.md new file mode 100644 index 0000000..7c7988d --- /dev/null +++ b/API-Reference.md @@ -0,0 +1,40 @@ +# API Reference + +This page summarizes the key classes in **Conflux**. + +## Ctx + +- `put(Key, T value)` — store or update a value for a key +- `get(Key)` — retrieve a value +- `contains(Key)` — check if a key is present +- `remove(Key)` — remove a key and its listeners +- `clear()` — remove everything +- `addListener(Key, Listener)` — register a weakly referenced listener +- `removeListener(Key, Listener)` — remove a listener + +## Key + +A strongly typed key: + +```java +Key nameKey = new Key<>("name", String.class); +```` + +* `name()` returns the key name +* `type()` returns the key type + +## Listener + +An interface for change notifications: + +```java +public interface Listener { + void valueChanged(T newValue); +} +``` + +Registered listeners will be weakly referenced and called on value change. + +--- + +\[\[Home]] | \[\[Programming Guide]] | \[\[Design and Architecture]] \ No newline at end of file