Annotation Type DtoMixin


@Target(TYPE) @Retention(CLASS) public @interface DtoMixin
Overlay DtoPath/DtoRef/DtoConvert annotations onto a DTO type that cannot be annotated directly - typically because it's generated elsewhere (e.g. from an OpenAPI spec) and regenerated on every build.

Declared on a companion interface (or class) whose methods mirror the target DTO's property names; the querybean-generator processor matches each mixin method to the corresponding property on value() by name, and applies whichever of @DtoPath/@DtoRef/ @DtoConvert is present on the mixin method as if it were declared on the target property itself. Mirrors avaje-jsonb's @Json.MixIn mechanism, which solves the exact same "can't annotate a generated/unowned type" problem.

@DtoMixin(Driver.class)
interface DriverDtoMixin {

  @DtoPath("encryptedDriverId")
  @DtoConvert(value = DriverConversions.class, method = "decrypt")
  String driverId();
}

This is purely a compile-time / codegen-time hint - the mixin type itself is never instantiated and carries no runtime footprint.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The real DTO type this mixin overlays annotations onto.
  • Element Details

    • value

      Class<?> value
      The real DTO type this mixin overlays annotations onto.