From 5f01eb90a4ea5c07ace82f84af0094db69c4b991 Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Tue, 20 Oct 2015 15:08:27 -0700 Subject: [PATCH 1/2] add javadocs for set vs add in structured query builder --- .../gcloud/datastore/StructuredQuery.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java b/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java index d88973dbda13..ffc68e67a0e4 100644 --- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java +++ b/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java @@ -113,6 +113,9 @@ static Filter fromPb(DatastoreV1.Filter filterPb) { } } + /* + * A class representing a filter composed of a combination of other filters. + */ public static final class CompositeFilter extends Filter { private static final long serialVersionUID = 3610352685739360009L; @@ -194,6 +197,9 @@ protected DatastoreV1.Filter toPb() { } } + /* + * A class representing a filter based on a single property or ancestor. + */ public static final class PropertyFilter extends Filter { private static final long serialVersionUID = -4514695915258598597L; @@ -514,6 +520,9 @@ static OrderBy fromPb(DatastoreV1.PropertyOrder propertyOrderPb) { } } + /* + * A class representing a projection based on a property. + */ public static final class Projection implements Serializable { private static final long serialVersionUID = 3083707957256279470L; @@ -665,12 +674,18 @@ public B clearOrderBy() { return self(); } + /* + * Clears all previously-specified OrderBy objects and orders by the given input instead. + */ public B orderBy(OrderBy orderBy, OrderBy... others) { clearOrderBy(); addOrderBy(orderBy, others); return self(); } + /* + * Adds one or more OrderBy objects to the existing list of OrderBy objects. + */ public B addOrderBy(OrderBy orderBy, OrderBy... others) { this.orderBy.add(orderBy); Collections.addAll(this.orderBy, others); @@ -682,12 +697,19 @@ B clearProjection() { return self(); } + /* + * Clears all previously-specified Projections and sets the list of Projections to the given + * input instead. + */ B projection(Projection projection, Projection... others) { clearProjection(); addProjection(projection, others); return self(); } + /* + * Adds one or more Projections to the existing list of Projections. + */ B addProjection(Projection projection, Projection... others) { this.projection.add(projection); Collections.addAll(this.projection, others); @@ -699,12 +721,19 @@ B clearGroupBy() { return self(); } + /* + * Clears all existing properties to group by and instead groups by the given the list of + * properties. + */ B groupBy(String property, String... others) { clearGroupBy(); addGroupBy(property, others); return self(); } + /* + * Adds one or more properties to the existing list of "group by" properties. + */ B addGroupBy(String property, String... others) { this.groupBy.add(property); Collections.addAll(this.groupBy, others); @@ -754,6 +783,9 @@ static final class Builder extends BaseBuilder> { } } + /* + * A StructuredQuery builder for queries that return Entity results. + */ public static final class EntityQueryBuilder extends BaseBuilder { EntityQueryBuilder() { @@ -766,6 +798,9 @@ public StructuredQuery build() { } } + /* + * A StructuredQuery builder for queries that return Key results. + */ public static final class KeyQueryBuilder extends BaseBuilder { KeyQueryBuilder() { @@ -787,6 +822,9 @@ public StructuredQuery build() { } } + /* + * A StructuredQuery builder for projection queries. + */ public static final class ProjectionEntityQueryBuilder extends BaseBuilder { From 8b129ced902dcd2c0dab8feee2d412921d74950d Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Tue, 20 Oct 2015 16:46:02 -0700 Subject: [PATCH 2/2] Fix javadoc wording and location --- .../gcloud/datastore/StructuredQuery.java | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java b/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java index ffc68e67a0e4..b592dc7b600f 100644 --- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java +++ b/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java @@ -113,7 +113,7 @@ static Filter fromPb(DatastoreV1.Filter filterPb) { } } - /* + /** * A class representing a filter composed of a combination of other filters. */ public static final class CompositeFilter extends Filter { @@ -197,7 +197,7 @@ protected DatastoreV1.Filter toPb() { } } - /* + /** * A class representing a filter based on a single property or ancestor. */ public static final class PropertyFilter extends Filter { @@ -520,7 +520,7 @@ static OrderBy fromPb(DatastoreV1.PropertyOrder propertyOrderPb) { } } - /* + /** * A class representing a projection based on a property. */ public static final class Projection implements Serializable { @@ -674,8 +674,8 @@ public B clearOrderBy() { return self(); } - /* - * Clears all previously-specified OrderBy objects and orders by the given input instead. + /** + * Sets the query's order by clause (clearing any previously specified OrderBy settings). */ public B orderBy(OrderBy orderBy, OrderBy... others) { clearOrderBy(); @@ -683,8 +683,8 @@ public B orderBy(OrderBy orderBy, OrderBy... others) { return self(); } - /* - * Adds one or more OrderBy objects to the existing list of OrderBy objects. + /** + * Adds settings to the existing order by clause. */ public B addOrderBy(OrderBy orderBy, OrderBy... others) { this.orderBy.add(orderBy); @@ -697,19 +697,12 @@ B clearProjection() { return self(); } - /* - * Clears all previously-specified Projections and sets the list of Projections to the given - * input instead. - */ B projection(Projection projection, Projection... others) { clearProjection(); addProjection(projection, others); return self(); } - /* - * Adds one or more Projections to the existing list of Projections. - */ B addProjection(Projection projection, Projection... others) { this.projection.add(projection); Collections.addAll(this.projection, others); @@ -721,19 +714,12 @@ B clearGroupBy() { return self(); } - /* - * Clears all existing properties to group by and instead groups by the given the list of - * properties. - */ B groupBy(String property, String... others) { clearGroupBy(); addGroupBy(property, others); return self(); } - /* - * Adds one or more properties to the existing list of "group by" properties. - */ B addGroupBy(String property, String... others) { this.groupBy.add(property); Collections.addAll(this.groupBy, others); @@ -783,7 +769,7 @@ static final class Builder extends BaseBuilder> { } } - /* + /** * A StructuredQuery builder for queries that return Entity results. */ public static final class EntityQueryBuilder extends BaseBuilder { @@ -798,7 +784,7 @@ public StructuredQuery build() { } } - /* + /** * A StructuredQuery builder for queries that return Key results. */ public static final class KeyQueryBuilder extends BaseBuilder { @@ -822,7 +808,7 @@ public StructuredQuery build() { } } - /* + /** * A StructuredQuery builder for projection queries. */ public static final class ProjectionEntityQueryBuilder @@ -842,11 +828,17 @@ public ProjectionEntityQueryBuilder clearProjection() { return super.clearProjection(); } + /** + * Sets the query's projection clause (clearing any previously specified Projection settings). + */ @Override public ProjectionEntityQueryBuilder projection(Projection projection, Projection... others) { return super.projection(projection, others); } + /** + * Adds one or more projections to the existing projection clause. + */ @Override public ProjectionEntityQueryBuilder addProjection(Projection projection, Projection... others) { return super.addProjection(projection, others); @@ -857,11 +849,17 @@ public ProjectionEntityQueryBuilder clearGroupBy() { return super.clearGroupBy(); } + /** + * Sets the query's group by clause (clearing any previously specified GroupBy settings). + */ @Override public ProjectionEntityQueryBuilder groupBy(String property, String... others) { return super.groupBy(property, others); } + /** + * Adds one or more properties to the existing group by clause. + */ @Override public ProjectionEntityQueryBuilder addGroupBy(String property, String... others) { return super.addGroupBy(property, others);