@Marz Annotation API
The @Marz annotation is the entire public API. Place it on a field to enable runtime configuration hot-swap.
Usage
@Marz(key = "feature.checkout.enabled",
source = "file://config/features.yml",
pollInterval = 3000,
fallback = "false")
private volatile boolean checkoutEnabled = false;
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
key | String | Yes | — | The configuration key path (dot-notation) |
source | String | No | Default config source | URI of the config source (file://, classpath://) |
pollInterval | long | No | 5000 | WatchService poll interval in milliseconds |
fallback | String | No | Field’s initial value | Value to use if source is unavailable |
type | Class<?> | No | Auto-detected | Explicit type hint for the field |
required | boolean | No | false | Fail startup if key is missing |
description | String | No | "" | Human-readable description for platform UI |
group | String | No | "" | Logical grouping for platform dashboard |
Supported field types
boolean/Booleanint/Integerlong/Longdouble/DoubleString
Thread safety
All @Marz fields must be declared volatile (for primitives and Strings) or wrapped in AtomicReference (for complex types). The library enforces this at startup and will fail with a clear error if the field is not thread-safe.
How reads work
A @Marz field is a plain volatile read — approximately 5 nanoseconds. There is no proxy, no method interception, no SDK call. The JVM’s memory model guarantees visibility across threads.