You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2022/08/16 10:38:22 UTC
[cayenne] branch master updated: Minor code and comments cleanup
This is an automated email from the ASF dual-hosted git repository.
ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new 56d8520cf Minor code and comments cleanup
56d8520cf is described below
commit 56d8520cfece65ae119563e9dab3f943876f1bfd
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Aug 16 13:38:15 2022 +0300
Minor code and comments cleanup
---
.../org/apache/cayenne/exp/property/EntityProperty.java | 7 ++++---
.../cayenne/exp/property/RelationshipProperty.java | 16 +++++++++++++---
.../org/apache/cayenne/exp/property/StringProperty.java | 2 +-
.../main/java/org/apache/cayenne/map/DbAttribute.java | 5 ++---
4 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/exp/property/EntityProperty.java b/cayenne-server/src/main/java/org/apache/cayenne/exp/property/EntityProperty.java
index c5a61af61..fd867736e 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/exp/property/EntityProperty.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/exp/property/EntityProperty.java
@@ -33,10 +33,11 @@ import org.apache.cayenne.exp.parser.ASTPath;
* ObjectSelect.query(Paintings.class)
* .where(Painting.TO_ARTIST.dot(Artist.ARTIST_NAME).eq("Pablo Picasso"));}</pre>
* <p>
- * Usage examples in column select, in this case full Artist entity will be
- * returned in the result: <pre>{@code
+ * Usage examples in column select, in this case full Artist entity will be returned as the result:
+ * <pre>{@code
* ObjectSelect
- * .columnQuery(Paintings.class, Painting.PAINTING_TITLE, Painting.TO_ARTIST);}</pre>
+ * .columnQuery(Paintings.class, Painting.PAINTING_TITLE, Painting.TO_ARTIST);}
+ * </pre>
*
* @see org.apache.cayenne.exp.property
* @since 4.2
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/exp/property/RelationshipProperty.java b/cayenne-server/src/main/java/org/apache/cayenne/exp/property/RelationshipProperty.java
index 33aa4da14..8c665d754 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/exp/property/RelationshipProperty.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/exp/property/RelationshipProperty.java
@@ -35,9 +35,7 @@ import org.apache.cayenne.query.PrefetchTreeNode;
public interface RelationshipProperty<E> extends PathProperty<E> {
/**
- * Returns a version of this property that represents an OUTER join. It is
- * up to caller to ensure that the property corresponds to a relationship,
- * as "outer" attributes make no sense.
+ * Returns a version of this property that represents an OUTER join.
*/
BaseProperty<E> outer();
@@ -77,10 +75,22 @@ public interface RelationshipProperty<E> extends PathProperty<E> {
return PrefetchTreeNode.withPath(getName(), PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
}
+ /**
+ * Constructs a new property path by appending the argument to the existing property separated by a dot.
+ *
+ * @param property to append to path
+ * @return a newly created Property object.
+ */
default <T> BaseIdProperty<T> dot(BaseIdProperty<T> property) {
return PropertyFactory.createBaseId(property.getAttributeName(), getName(), property.getEntityName(), property.getType());
}
+ /**
+ * Constructs a new property path by appending the argument to the existing property separated by a dot.
+ *
+ * @param property to append to path
+ * @return a newly created Property object.
+ */
default <T extends Number> NumericIdProperty<T> dot(NumericIdProperty<T> property) {
return PropertyFactory.createNumericId(property.getAttributeName(), getName(), property.getEntityName(), property.getType());
}
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/exp/property/StringProperty.java b/cayenne-server/src/main/java/org/apache/cayenne/exp/property/StringProperty.java
index bd388e383..ee04eba7f 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/exp/property/StringProperty.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/exp/property/StringProperty.java
@@ -264,7 +264,7 @@ public class StringProperty<E extends CharSequence> extends BaseProperty<E> impl
exp[i++] = getExpression();
for(Object arg : args) {
if(arg instanceof BaseProperty) {
- exp[i++] = ((BaseProperty) arg).getExpression();
+ exp[i++] = ((BaseProperty<?>) arg).getExpression();
} else if(arg instanceof Expression) {
exp[i++] = (Expression) arg;
} else if(arg != null) {
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/map/DbAttribute.java b/cayenne-server/src/main/java/org/apache/cayenne/map/DbAttribute.java
index 5d707a512..f9b93bc20 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/map/DbAttribute.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/map/DbAttribute.java
@@ -53,7 +53,7 @@ public class DbAttribute extends Attribute<DbEntity, DbAttribute, DbRelationship
*/
protected boolean generated;
- // The length of CHAR or VARCHAr or max num of digits for DECIMAL.
+ // The length of CHAR or VARCHAR or max num of digits for DECIMAL.
protected int maxLength = -1;
/**
@@ -64,8 +64,7 @@ public class DbAttribute extends Attribute<DbEntity, DbAttribute, DbRelationship
/**
* @since 3.0
*/
- // must call it 'attributePrecison' as 'precision' in 1.2 really meant
- // 'scale'
+ // must call it 'attributePrecision' as 'precision' in 1.2 really meant 'scale'
protected int attributePrecision = -1;
public DbAttribute() {