From 5e8aff056c32b71344c716173aa56c83da75adf1 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Thu, 27 Apr 2017 08:25:01 +0200 Subject: [PATCH] #312 - Documentation corrections as requested by Mobe91 --- .../entity-view/manual/en_US/04_mappings.adoc | 16 ++++++++-------- .../persistence/view/EntityViewInheritance.java | 2 +- .../ScalarTargetResolvingExpressionVisitor.java | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/documentation/src/main/asciidoc/entity-view/manual/en_US/04_mappings.adoc b/documentation/src/main/asciidoc/entity-view/manual/en_US/04_mappings.adoc index 89a377b669..98ab38c3b8 100644 --- a/documentation/src/main/asciidoc/entity-view/manual/en_US/04_mappings.adoc +++ b/documentation/src/main/asciidoc/entity-view/manual/en_US/04_mappings.adoc @@ -54,7 +54,7 @@ interface CatView extends NameView, AgeView { } ---- -In this example `CatView` has two attributes, `name` and `age`. Even though the interfaces aren't entity views, they could have custom mappings. +In this example `CatView` has two attributes, `name` and `age`. Even though the interfaces are not entity views, they could have custom mappings. // TODO: Warn about equlas-hashCode implementations in abstract classes @@ -1337,18 +1337,18 @@ public abstract class CatView { } } ---- -<1> If the unsafe proxy is used, `getAge()` will return the actual value, otherwise will return `null` +<1> If the unsafe proxy is used, `getAge()` will return the actual value, otherwise it will return `null` === Inheritance mapping -Entity views can have an inheritance relationship to subtypes via an inheritance mapping. This relationship allows instances of an entity view subtype to be materialized when a selection predicate, -that is defined by an inheritance mapping, is satisfied. +Entity views can have an inheritance relationship to subtypes via an inheritance mapping. This relationship allows instances of an entity view subtype to be materialized when a selection predicate +defined by an inheritance mapping is satisfied. The inheritance feature for an entity view is activated by annotating link:{entity_view_jdoc}/persistence/view/EntityViewInheritance.html[`@EntityViewInheritance`] on an entity view. By default, all subtypes of the entity view are considered as inheritance subtypes and thus require a so called _inheritance mapping_. -A _inheritance mapping_ is defined by annotating the subtype with link:{entity_view_jdoc}/persistence/view/EntityViewInheritanceMapping.html[`@EntityViewInheritanceMapping`] and defining -a selection predicate that represents the condition on which is decided whether an instance of that subtype should be constructed. The predicate is a normal link:{core_doc}#expressions[JPQL predicate expression] +An _inheritance mapping_ is defined by annotating the subtype with link:{entity_view_jdoc}/persistence/view/EntityViewInheritanceMapping.html[`@EntityViewInheritanceMapping`] and defining +a selection predicate that represents the condition on which decides the instantiation of that subtype. The predicate is a normal link:{core_doc}#expressions[JPQL predicate expression] and can refer to all attributes of the mapped entity type. Consider the following example @@ -1395,7 +1395,7 @@ LEFT JOIN cat.mother mother_1 LEFT JOIN cat.kittens kittens_1 ---- -The type index 0 refers to the base type `BaseCatView` and in this case instances of `BaseCatView` are materialized when the age of a result is exactly 18. +The type index 0 refers to the base type `BaseCatView`, hence instances of `BaseCatView` are materialized when the age of a result equals 18. Since it might not be desirable to use all entity view subtypes for the inheritance relationship, it is possible to explicitly declare the subtypes in the `@EntityViewInheritance` annotation on the super type. @@ -1412,7 +1412,7 @@ This has the effect, that only `BaseCatView` or `YoungCatView` instances are mat === Inheritance subview mapping -Similarly to specifying the entity view inheritance subtypes at the declaration site i.e. `BaseCatView` it is also possible to define subtypes at the _use site_ i.e. the subview attribute. +Similarly to specifying the entity view inheritance subtypes at the declaration site, i.e. `BaseCatView`, it is also possible to define subtypes at the _use site_, i.e. at the subview attribute. By annotating the subview attribute with `@MappingInheritance`, it is possible to delimit and override the entity view subtype mappings that are considered for materialization from the result. When using the `@MappingInheritance` annotation, it is required to list all desired subtypes via `@MappingInheritanceSubtype` annotations that can optionally override the inheritance mapping. diff --git a/entity-view/api/src/main/java/com/blazebit/persistence/view/EntityViewInheritance.java b/entity-view/api/src/main/java/com/blazebit/persistence/view/EntityViewInheritance.java index b7d12cc15b..2a22c6830d 100644 --- a/entity-view/api/src/main/java/com/blazebit/persistence/view/EntityViewInheritance.java +++ b/entity-view/api/src/main/java/com/blazebit/persistence/view/EntityViewInheritance.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * Specifies that the entity view when queried should consider subtypes of the entity view. + * Specifies that the entity view should consider subtypes of the entity view when queried. * * @author Christian Beikov * @since 1.2.0 diff --git a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/ScalarTargetResolvingExpressionVisitor.java b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/ScalarTargetResolvingExpressionVisitor.java index 2c66f1202f..ea7d1a6333 100644 --- a/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/ScalarTargetResolvingExpressionVisitor.java +++ b/entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/ScalarTargetResolvingExpressionVisitor.java @@ -349,7 +349,7 @@ public void visit(ParameterExpression expression) { // NOTE: We use null as marker for ANY TYPE currentPosition.setCurrentClass(null); } else { - // If there are other branches(path positions) i.e. of a case when that have a type, we can allow parameters too + // If there are other branches (path positions) i.e. of a case when that have a type, we can allow parameters too for (PathPosition position : pathPositions) { if (position != currentPosition) { if (position.getCurrentClass() != null) {