From 1e1a6e0b7c71d816693d216dc0f27c747c7b078d Mon Sep 17 00:00:00 2001 From: Leo Galambos Date: Thu, 3 Jul 2025 22:50:46 +0200 Subject: [PATCH] Add API Reference --- API-Reference.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 API-Reference.md 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