diff --git a/repository/src/main/java/tech/ydb/yoj/repository/db/Table.java b/repository/src/main/java/tech/ydb/yoj/repository/db/Table.java index a9a5548f..10d8e7df 100644 --- a/repository/src/main/java/tech/ydb/yoj/repository/db/Table.java +++ b/repository/src/main/java/tech/ydb/yoj/repository/db/Table.java @@ -160,7 +160,7 @@ default > Stream readTableIds() { default FirstLevelCache getFirstLevelCache() { return null; - }; + } @NonNull default T find(Entity.Id id, Supplier throwIfAbsent) throws X { @@ -350,23 +350,38 @@ default TableQueryBuilder query() { @Deprecated void update(Entity.Id id, Changeset changeset); + /** + * Base interface for views, that is, arbitrary subsets of {@link Entity} fields. + * + * @see ViewId + */ interface View { } - interface ViewId> extends View { - Entity.Id getId(); + /** + * Base interface for ID-aware views, that is, subsets of {@link Entity} fields + * that contain the Entity's ID. + * + * @param entity type + * @see RecordViewId + */ + interface ViewId> extends View { + Entity.Id getId(); } /** - * Base interface for ID-aware table views that are Java {@link java.lang.Record records}. - *

Forwards {@link ViewId#getId() ViewId's getId() method} to the record's {@code id()} accessor. + * Base interface for ID-aware views that are implemented as {@link java.lang.Record Java Records}. + *

Forwards {@link ViewId#getId() ViewId's getId() method} to the record's {@code id()} accessor, + * so you don't need to override the {@code getId()} method yourself. * * @param entity type + * @see ViewId */ - interface RecordViewId> extends ViewId { - Entity.Id id(); + interface RecordViewId> extends ViewId { + Entity.Id id(); - default Entity.Id getId() { + @Override + default Entity.Id getId() { return id(); } }