@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

ParameterTypeRequiredDefaultDescription
keyStringYesThe configuration key path (dot-notation)
sourceStringNoDefault config sourceURI of the config source (file://, classpath://)
pollIntervallongNo5000WatchService poll interval in milliseconds
fallbackStringNoField’s initial valueValue to use if source is unavailable
typeClass<?>NoAuto-detectedExplicit type hint for the field
requiredbooleanNofalseFail startup if key is missing
descriptionStringNo""Human-readable description for platform UI
groupStringNo""Logical grouping for platform dashboard

Supported field types

  • boolean / Boolean
  • int / Integer
  • long / Long
  • double / Double
  • String

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.