class

Settings

@Js
const class Settings : Obj, Dict

Settings wraps a dict that maps tags to statically typed fields for extension settings. To use this API:

  1. Create subclass of Settings
  2. Annotate const instance fields with @Setting
  3. Create constructor with Dict and it-block callback

The following coercions are supported:

  • Int field from Number tag
  • Duration field from Number tag
  • Bool field from Marker tag

Example:

const class ExampleSettings : Settings
{
  static new wrap(Dict d, |Str|? onErr := null) { create(ExampleRec#, d, onErr) }

  new make(Dict d, |This| f) : super(d) { f(this) }

  @Setting const Int limit := 99

  @Setting const Duration timeout := 3sec
}

constructors make

Sub constructor

methods meta

Wrapped dict for this instance

get

Get a tag from wrapped dict

isEmpty

Return if wrapped dict is empty

missing

Return if wrapped dict is missing given tag

create

Factory to create for given type and dict to wrap

has

Return if wrapped dict has given tag

trap

Trap on the wrapped dict

eachWhile

Iterate the wrapped dict tags until callback returns non-null

each

Iterate the wrapped dict tags

create static Settings create(Type type, Dict meta, |Str|? onErr)

Factory to create for given type and dict to wrap. Invalid tag values are logged to the given callback if provided.

each virtual Void each(|Obj,Str| f)

Iterate the wrapped dict tags

eachWhile virtual Obj? eachWhile(|Obj,Str->Obj?| f)

Iterate the wrapped dict tags until callback returns non-null

get @Operator
virtual Obj? get(Str n)

Get a tag from wrapped dict

has virtual Bool has(Str n)

Return if wrapped dict has given tag

isEmpty virtual Bool isEmpty()

Return if wrapped dict is empty

make new make(Dict meta)

Sub constructor.

meta Dict meta()

Wrapped dict for this instance

missing virtual Bool missing(Str n)

Return if wrapped dict is missing given tag

trap virtual Obj? trap(Str n, Obj?[]? a)

Trap on the wrapped dict

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST