From 8b98335e2ed732d9913297f7e7e6a551c72f25c4 Mon Sep 17 00:00:00 2001 From: rbygrave Date: Wed, 8 Sep 2021 10:42:51 +1200 Subject: [PATCH] #2359 - Rename plugin api methods with deprecation - BeanDocType --- .../java/io/ebean/plugin/BeanDocType.java | 32 +++++++++++++++++++ .../java/io/ebean/plugin/BeanTypeTest.java | 16 +++++----- .../support/DocStoreBeanBaseAdapterTest.java | 4 +-- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/ebean-api/src/main/java/io/ebean/plugin/BeanDocType.java b/ebean-api/src/main/java/io/ebean/plugin/BeanDocType.java index 92b3d6d19..33bcc3786 100644 --- a/ebean-api/src/main/java/io/ebean/plugin/BeanDocType.java +++ b/ebean-api/src/main/java/io/ebean/plugin/BeanDocType.java @@ -16,11 +16,27 @@ public interface BeanDocType { /** * Return the doc store index type for this bean type. */ + default String indexType() { + return getIndexType(); + } + + /** + * Deprecated migrate to indexType(). + */ + @Deprecated String getIndexType(); /** * Return the doc store index name for this bean type. */ + default String indexName() { + return getIndexName(); + } + + /** + * Deprecated migrate to indexName(). + */ + @Deprecated String getIndexName(); /** @@ -32,12 +48,28 @@ public interface BeanDocType { /** * Return the FetchPath for the embedded document. */ + default FetchPath embedded(String path) { + return getEmbedded(path); + } + + /** + * Deprecated migrate to embedded(). + */ + @Deprecated FetchPath getEmbedded(String path); /** * For embedded 'many' properties we need a FetchPath relative to the root which is used to * build and replace the embedded list. */ + default FetchPath embeddedManyRoot(String path) { + return getEmbedded(path); + } + + /** + * Deprecated migrate to embeddedManyRoot(). + */ + @Deprecated FetchPath getEmbeddedManyRoot(String path); /** diff --git a/ebean-core/src/test/java/io/ebean/plugin/BeanTypeTest.java b/ebean-core/src/test/java/io/ebean/plugin/BeanTypeTest.java index fd54a95a7..fe24cfc96 100644 --- a/ebean-core/src/test/java/io/ebean/plugin/BeanTypeTest.java +++ b/ebean-core/src/test/java/io/ebean/plugin/BeanTypeTest.java @@ -114,7 +114,7 @@ public class BeanTypeTest { public void docStore_getEmbedded() { BeanDocType orderDocType = beanType(Order.class).docStore(); - FetchPath customer = orderDocType.getEmbedded("customer"); + FetchPath customer = orderDocType.embedded("customer"); assertThat(customer).isNotNull(); assertThat(customer.getProperties(null)).contains("id", "name"); } @@ -124,10 +124,10 @@ public class BeanTypeTest { BeanDocType orderDocType = beanType(Order.class).docStore(); - FetchPath detailsPath = orderDocType.getEmbedded("details"); + FetchPath detailsPath = orderDocType.embedded("details"); assertThat(detailsPath).isNotNull(); - FetchPath detailsRoot = orderDocType.getEmbeddedManyRoot("details"); + FetchPath detailsRoot = orderDocType.embeddedManyRoot("details"); assertThat(detailsRoot).isNotNull(); assertThat(detailsRoot.getProperties(null)).containsExactly("id", "details"); assertThat(detailsRoot.hasPath("details")).isTrue(); @@ -143,15 +143,15 @@ public class BeanTypeTest { @Test public void getDocStoreIndexType() { - assertThat(beanType(Order.class).docStore().getIndexType()).isEqualTo("order"); - assertThat(beanType(Customer.class).docStore().getIndexType()).isEqualTo("customer"); + assertThat(beanType(Order.class).docStore().indexType()).isEqualTo("order"); + assertThat(beanType(Customer.class).docStore().indexType()).isEqualTo("customer"); } @Test public void getDocStoreIndexName() { - assertThat(beanType(Order.class).docStore().getIndexType()).isEqualTo("order"); - assertThat(beanType(Customer.class).docStore().getIndexType()).isEqualTo("customer"); + assertThat(beanType(Order.class).docStore().indexType()).isEqualTo("order"); + assertThat(beanType(Customer.class).docStore().indexType()).isEqualTo("customer"); } @Test @@ -159,7 +159,7 @@ public class BeanTypeTest { FetchPath parse = PathProperties.parse("id,name"); - FetchPath nestedCustomer = beanType(Order.class).docStore().getEmbedded("customer"); + FetchPath nestedCustomer = beanType(Order.class).docStore().embedded("customer"); assertThat(nestedCustomer.toString()).isEqualTo(parse.toString()); } diff --git a/ebean-core/src/test/java/io/ebeanservice/docstore/api/support/DocStoreBeanBaseAdapterTest.java b/ebean-core/src/test/java/io/ebeanservice/docstore/api/support/DocStoreBeanBaseAdapterTest.java index 4d14bd503..e792aa0cc 100644 --- a/ebean-core/src/test/java/io/ebeanservice/docstore/api/support/DocStoreBeanBaseAdapterTest.java +++ b/ebean-core/src/test/java/io/ebeanservice/docstore/api/support/DocStoreBeanBaseAdapterTest.java @@ -31,8 +31,8 @@ public class DocStoreBeanBaseAdapterTest extends BaseTestCase { TDAdapter adapter = new TDAdapter<>(orderDesc, deployDesc); - assertThat(adapter.getIndexName()).isEqualTo("order"); - assertThat(adapter.getIndexType()).isEqualTo("order"); + assertThat(adapter.indexName()).isEqualTo("order"); + assertThat(adapter.indexType()).isEqualTo("order"); assertThat(adapter.getQueueId()).isEqualTo("order"); }