public interface MetaModelReferenceExpansionDsl<T,C,E> extends ReferenceExpansionDsl<T,C>
Modifier and Type | Method and Description |
---|---|
C |
plusExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
Creates a new object with the properties of the old object but adds a new expansion path to it by using meta models.
|
C |
withExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
Creates a new object with the properties of the old object but replaces all expansion paths with a single
expansionPath by using meta models. |
plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths
expansionPaths
C plusExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
An example in the product projection context:
final ProductProjectionByIdGet fetch1 = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .plusExpansionPaths(m -> m.categories()); assertThat(fetch1.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch1.plusExpansionPaths(m -> m.productType()); assertThat(fetch2.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"), ExpansionPath.of("productType"))) .isEqualTo(listOf(fetch1.expansionPaths(), ExpansionPath.of("productType"))); //this is equivalent to final ExpansionPath<ProductProjection> categoryExpand = ProductProjectionExpansionModel.of().categories().expansionPaths().get(0); final ExpansionPath<ProductProjection> productTypeExpand = ProductProjectionExpansionModel.of().productType().expansionPaths().get(0); final ProductProjectionByIdGet fetchB = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .withExpansionPaths(asList(categoryExpand, productTypeExpand)); assertThat(fetchB.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"), ExpansionPath.of("productType")));
See the test code.
m
- function to use the meta model for expansions to create an expansion pathC withExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
expansionPath
by using meta models.
An example in the product projection context:
final ProductProjectionByIdGet fetch = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .plusExpansionPaths(ProductProjectionExpansionModel.of().categories()); assertThat(fetch.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch.withExpansionPaths(m -> m.productType()); assertThat(fetch.expansionPaths()).overridingErrorMessage("old object is unchanged") .isEqualTo(asList(ExpansionPath.of("categories[*]"))); assertThat(fetch2.expansionPaths()).isEqualTo(asList(ExpansionPath.of("productType"))); assertThat(fetch2).isNotSameAs(fetch);
See the test code.
m
- function to use the meta model for expansions to create an expansion path