OptionsBuilder
Ce contenu n’est pas encore disponible dans votre langue.
Defined in: src/util/OptionsBuilder.ts:39
Base class for the framework’s fluent options builders — the shared
mechanics behind MqttOptions, KafkaOptions, ActorSystemOptions,
and every other <X>Options builder.
Design (matches the hand-written MqttOptions that seeded this):
- Mutable,
this-returning. Each concretewithX(...)calls the protected set and returnsthis, so chaining stays typed as the concrete subclass across inheritance levels (no F-boundedSelfgeneric needed —thisalready IS the subclass). - A builder is its options. set writes each field as an
own enumerable property of the builder instance, so a builder is
structurally a bag of the fields you set. Consumers accept the
XOptionsunion (XOptionsBuilder | Partial<XOptionsType>) and read / spread the argument directly — no separate “resolve” step. ThewithX/buildmethods live on the prototype, so they never surface when the options are spread ({ ...options }), enumerated (Object.keys), or serialized (JSON.stringify): only the set fields do. (The consumer keeps the union in its signature because a builder — a methods-only type — is not assignable to a barePartial<T>: TypeScript’s weak-type check would reject it. Reading the options out of the argument is a plain cast:options as XOptionsType/{ ...(options as Partial<XOptionsType>) }.) build()snapshots. It returns an independentPartial<T>(a copy of the own fields) for the rare caller that wants to freeze a builder it intends to keep mutating; ordinary consumers don’t need it because they already read/spread the argument.- Feeds the existing resolution. Wherever HOCON is layered in — the
broker actors,
ClusterSharding.start— the options are the highest-precedence layer ofmergeOptions(defaults, HOCON, explicit); because a builder records ONLY the fields you set, unset fields fall through to HOCON — the builder never competes with config.
A builder instance is a throwaway construction helper: methods mutate in place, so a single instance is not a branch point (two chains off the same instance share state).
Extended by
Section titled “Extended by”ActorSystemOptionsBuilderActorOptionsBuilderMetricsRegistryOptionsBuilderCircuitBreakerOptionsBuilderScatterGatherOptionsBuilderAvroSerializerOptionsBuilderProtobufSerializerOptionsBuilderConsumerControllerOptionsBuilderBoundedMailboxOptionsBuilderPriorityMailboxOptionsBuilderClusterOptionsBuilderClusterBootstrapOptionsBuilderStableObservationOptionsBuilderFailureDetectorOptionsBuilderPhiAccrualOptionsBuilderKeepOldestOptionsBuilderStaticQuorumOptionsBuilderKeepRefereeOptionsBuilderKeepMajorityOptionsBuilderLeaseMajorityOptionsBuilderClusterSingletonManagerOptionsBuilderStartSingletonOptionsBuilderDistributedPubSubOptionsBuilderShardedDaemonProcessOptionsBuilderShardingOptionsBuilderShardCoordinatorOptionsBuilderCassandraRememberEntitiesStoreOptionsBuilderClusterRouterOptionsBuilderClusterClientOptionsBuilderClusterClientReceptionistOptionsBuilderHstsOptionsBuilderCspOptionsBuilderSecurityHeadersOptionsBuilderCorsOptionsBuilderCsrfOptionsBuilderSameOriginOptionsBuilderRequestIdOptionsBuilderBasicAuthOptionsBuilderTimeoutOptionsBuilderStaticFilesOptionsBuilderExpressBackendOptionsBuilderHonoBackendOptionsBuilderRateLimitOptionsBuilderIdempotencyOptionsBuilderWebsocketRouteOptionsBuilder
Type Parameters
Section titled “Type Parameters”T extends object
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OptionsBuilder<
T>():OptionsBuilder<T>
Returns
Section titled “Returns”OptionsBuilder<T>
Methods
Section titled “Methods”build()
Section titled “build()”build():
Partial<T>
Defined in: src/util/OptionsBuilder.ts:51
Snapshot the set fields as an independent Partial<T> (own props only).
Returns
Section titled “Returns”Partial<T>
