I've got several rest-dtos that have identical field - list of currencies represented by CurrencyUnit (java-money)
import javax.money.CurrencyUnit;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Schema;
...
@ArraySchema(schema = @Schema(type = "string"),
arraySchema = @Schema(
example = "[\"USD\",\"CAD\"]",
description = "Currencies supported by store according to ISO_4217."
))
private List<CurrencyUnit> currencies;
What's the correct way to extract all this metadata into single @CurrencyCodesList annotation to reuse across multiples models?