Decorator overview
All decorators are exported from lombok-typescript/legacy and lombok-typescript/stage3.
Phase 1 (v0.1)
| Decorator | Kind | Codegen? | Summary |
|---|---|---|---|
@NonNull | Runtime field | No | Reject null / undefined on assignment |
@ToString | Codegen | Yes | Generated toString() |
@Builder | Codegen | Yes | Fluent builder class |
@Data | Codegen composite | Yes | Getters, setters, equals, toString |
@Singleton | Runtime class | No | Single shared instance per class |
@Prototype | Runtime class | No | New instance on every new |
@Factory | Hybrid | Partial | Named factory registry |
@Memoize | Runtime method | No | Cache method results by arguments |
Phase 2 (v0.2.0–0.4.0)
| Decorator | Kind | Codegen? | Summary |
|---|---|---|---|
@Value | Codegen composite | Yes | Immutable @Data + with* |
@With | Codegen | Yes | Per-field immutable copy helpers |
@Equals | Codegen | Yes | Structural equals + static helper |
@Getter / @Setter | Codegen field | Yes | Single-field accessors |
@Log | Runtime | No | Method entry logging |
@Accessors | Codegen metadata | Yes | Fluent/chained setter style |
@UtilityClass | Runtime | No | Uninstantiable utility holder |
@FieldDefaults | Codegen metadata | Yes | Default readonly for generated code |
@Delegate | Codegen field | Yes | Forward methods to a field |
@Data and @Value cannot be combined — codegen enforces this at generation time.
Phase 3 (v0.5.0–v0.6.0)
| Decorator | Kind | Codegen? | Summary |
|---|---|---|---|
@Strategy | Hybrid | No | Two-level algorithm registry |
@State / @Transition | Runtime | No | Finite state machine |
@Command | Runtime | No | Command objects + undo stack |
@Memento | Runtime | No | Snapshot / restore |
@Observable | Runtime | No | Reactive property subscriptions |
@ChainOfResponsibility | Runtime | No | Ordered handler chain |
@Iterable | Runtime | No | Symbol.iterator over a field |
Observer adapters: RxJS / MobX.
Phase 4a (v0.7.0)
| Decorator | Kind | Codegen? | Summary |
|---|---|---|---|
@Flyweight | Runtime | No | Instance pool keyed by constructor |
@Proxy | Hybrid (runtime) | No | Method before/after hooks |
@Composite | Runtime | Shim | Tree add/remove/traverse API |
Phase 4b (v0.8.0)
| Decorator | Kind | Codegen? | Summary |
|---|---|---|---|
@Wraps | Runtime | Shim | GoF Decorator — inner delegation |
@TemplateMethod / @Hook | Codegen + metadata | Yes | Ordered template method steps |
@AbstractFactory | Codegen Helper | Yes | Abstract product factory stubs |
@Visitor / @Visitable | Hybrid | Yes | Double-dispatch accept(visitor) |
Phase 5 (v0.9.0)
| Decorator | Kind | Codegen? | Summary |
|---|---|---|---|
@Retry | Runtime method | No | Async retry with backoff |
@Debounce / @Throttle | Runtime method | No | Debounce or throttle invocations |
@Trace | Runtime | No | Method entry/exit logging |
@DeepFreeze | Runtime class | No | Recursive Object.freeze on new |
@Validate | Hybrid | Partial | Zod/Yup/class-validator adapters |
@Serializable | Hybrid | Yes | toJSON / fromJSON codegen |
Validator adapters: lombok-typescript/validators/{zod,yup,class-validator} (optional peer deps).
Phase 6 (v0.10.0) — Marker-only
Complete GoF coverage with metadata-only decorators (no codegen).
| Decorator | Kind | Codegen? | Summary |
|---|---|---|---|
@Adapter | Marker class | No | Documents API adapter intent |
@Bridge | Marker class | No | Abstraction / implementation split |
@Facade | Marker class | No | Subsystem simplification |
@Mediator | Marker class | No | Colleague coordination role |
@Interpreter | Marker class | No | DSL / grammar interpreter role |
@Adapter (GoF) is unrelated to ValidatorAdapter in the validators subpath exports.
Codegen decorators
Run after changing decorated classes:
bash
lombok-ts generate
# or watch for changes:
lombok-ts watchThen call applyAllGenerated (or per-class apply*Generated) from the .lombok.ts companion.
Choosing a backend
ts
// Legacy
import { Data, Value } from 'lombok-typescript/legacy';
// Stage 3
import { Data, Value } from 'lombok-typescript/stage3';See Getting started for tsconfig requirements.