Skip to content

Commit

Permalink
Minor refactoring and javadoc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay Kannan committed Jan 27, 2016
1 parent 8ad3235 commit f287462
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final class EntityQuery extends StructuredQuery<Entity> {
private static final long serialVersionUID = 2990565454831019471L;

/**
* A {@code EntityQuery} builder for queries that return Entity results.
* A {@code EntityQuery} builder for queries that return {@link Entity} results.
*/
public static final class Builder extends StructuredQuery.BuilderImpl<Entity, Builder> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final class KeyQuery extends StructuredQuery<Key> {
private static final long serialVersionUID = -746768461459070045L;

/**
* A {@code KeyQuery} builder for queries that return Key results.
* A {@code KeyQuery} builder for queries that return {@link Key} results.
*/
public static final class Builder extends StructuredQuery.BuilderImpl<Key, Builder> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public final class ProjectionEntityQuery extends StructuredQuery<ProjectionEntit
private static final long serialVersionUID = 5488451194542425391L;

/**
* A {@code ProjectionEntityQuery} builder for queries that return Key results.
* A {@code ProjectionEntityQuery} builder for queries that return {@link ProjectionEntity}
* results.
*/
public static final class Builder extends StructuredQuery.BuilderImpl<ProjectionEntity, Builder> {

Expand All @@ -43,6 +44,7 @@ public static final class Builder extends StructuredQuery.BuilderImpl<Projection
/**
* Clears the projection clause.
*/
@Override
public Builder clearProjection() {
super.clearProjection();
return this;
Expand All @@ -51,6 +53,7 @@ public Builder clearProjection() {
/**
* Sets the query's projection clause (clearing any previously specified Projection settings).
*/
@Override
public Builder projection(Projection projection, Projection... others) {
super.projection(projection, others);
return this;
Expand All @@ -59,6 +62,7 @@ public Builder projection(Projection projection, Projection... others) {
/**
* Adds one or more projections to the existing projection clause.
*/
@Override
public Builder addProjection(Projection projection, Projection... others) {
super.addProjection(projection, others);
return this;
Expand All @@ -67,6 +71,7 @@ public Builder addProjection(Projection projection, Projection... others) {
/**
* Clears the group by clause.
*/
@Override
public Builder clearGroupBy() {
super.clearGroupBy();
return this;
Expand All @@ -75,6 +80,7 @@ public Builder clearGroupBy() {
/**
* Sets the query's group by clause (clearing any previously specified GroupBy settings).
*/
@Override
public Builder groupBy(String property, String... others) {
super.groupBy(property, others);
return this;
Expand All @@ -83,6 +89,7 @@ public Builder groupBy(String property, String... others) {
/**
* Adds one or more properties to the existing group by clause.
*/
@Override
public Builder addGroupBy(String property, String... others) {
super.addGroupBy(property, others);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,11 @@ public void testToAndFromPb() {

@Test
public void testToBuilder() {
StructuredQuery<Entity> entityQuery =
Query.entityQueryBuilder().namespace("n1").kind("k1").build();
Query<Entity> entityQueryResult = entityQuery.toBuilder().build();
StructuredQuery<Key> keyQuery = Query.keyQueryBuilder().namespace("n2").kind("k2").build();
Query<Key> keyQueryResult = keyQuery.toBuilder().build();
StructuredQuery<ProjectionEntity> projectionEntityQuery = Query.projectionEntityQueryBuilder()
.kind("k3")
.projection(Projection.property("p1"), Projection.property("p2"))
.build();
Query<ProjectionEntity> projectionEntityQueryResult = projectionEntityQuery.toBuilder().build();
assertEquals(entityQuery, entityQueryResult);
assertTrue(entityQueryResult instanceof EntityQuery);
assertEquals(keyQuery, keyQueryResult);
assertTrue(keyQueryResult instanceof KeyQuery);
assertEquals(projectionEntityQuery, projectionEntityQueryResult);
assertTrue(projectionEntityQueryResult instanceof ProjectionEntityQuery);
List<StructuredQuery<?>> queries =
ImmutableList.<StructuredQuery<?>>of(ENTITY_QUERY, KEY_QUERY, PROJECTION_QUERY);
for (StructuredQuery<?> query : queries) {
assertEquals(query, query.toBuilder().build());
}
}

@Test
Expand Down

0 comments on commit f287462

Please sign in to comment.