NCronJob icon indicating copy to clipboard operation
NCronJob copied to clipboard

[V5] Straighten JobOptionBuilder API

Open nulltoken opened this issue 10 months ago • 0 comments

#215 introduced a branch in the fluent interface for the sake of backward compatibility. It also put under the light an issue with the current design which allows .WithParameter().WithParameter() chaining (each call overriding the last value).

Proposal would be to have a directed fluent interface with allowed root nodes. Each allowed root nodes would reduce the possibility of possible sub nodes.

jo => jo.WithName().WithCronExpression().WithParameter()
jo => jo.WithCronExpression().WithParameter()
jo => jo.WithName().WithParameter()
jo => jo.WithParameter()
  • WthParameter() would always be a leaf node.

Each node would allow to also expose a And property which would allow to break out of the current option and return the current JobOptionBuilder instance.

nulltoken avatar Feb 27 '25 20:02 nulltoken