Код: Выделить всё
@Schema(
discriminatorMapping = {
@DiscriminatorMapping(value = "type1", schema = Type1.class),
@DiscriminatorMapping(value = "type2", schema = Type2.class),
@DiscriminatorMapping(value = "type3", schema = Type3.class),
},
discriminatorProperty = "type",
oneOf = {Type1.class,
Type2.class,
Type3.class
}
)
public interface MainInterface {
@Schema(
requiredMode = Schema.RequiredMode.REQUIRED,
example = "type1"
)
Type getType();
}
< /code>
Есть свойства, которые используются по этим типам дочерних интерфейсов. Таким образом, мы хотим добавить общие Getters в MainInterface
Код: Выделить всё
public interface SharedProperties {
String getName();
String getDescription();
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... e-for-open