Skip to content

@Facade

Marker-only — documents a facade that simplifies access to one or more subsystems.

KindMarker-only class
Backendslegacy, stage3
Requires generateNo

Example

ts
import { Facade } from 'lombok-typescript/legacy';

class PaymentApi {
  charge(amount: number) {
    return `charged ${amount}`;
  }
}

class InventoryApi {
  reserve(sku: string) {
    return `reserved ${sku}`;
  }
}

@Facade({ subsystems: [PaymentApi, InventoryApi] })
class CheckoutFacade {
  constructor(
    private payments = new PaymentApi(),
    private inventory = new InventoryApi(),
  ) {}
  checkout(sku: string, amount: number) {
    return [this.inventory.reserve(sku), this.payments.charge(amount)];
  }
}

Optional subsystems are stored in metadata for documentation tooling.

Released under the MIT License.