Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Javadocs for set vs add in StructuredQuery's builder #275

Merged
merged 2 commits into from
Oct 21, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -665,12 +674,18 @@ public B clearOrderBy() {
return self();
}

/**
* Sets the query's order by clause (clearing any previously specified OrderBy settings).
*/
public B orderBy(OrderBy orderBy, OrderBy... others) {
clearOrderBy();
addOrderBy(orderBy, others);
return self();
}

/**
* Adds settings to the existing order by clause.
*/
public B addOrderBy(OrderBy orderBy, OrderBy... others) {
this.orderBy.add(orderBy);
Collections.addAll(this.orderBy, others);
Expand Down Expand Up @@ -754,6 +769,9 @@ static final class Builder<V> extends BaseBuilder<V, Builder<V>> {
}
}

/**
* A StructuredQuery builder for queries that return Entity results.
*/
public static final class EntityQueryBuilder extends BaseBuilder<Entity, EntityQueryBuilder> {

EntityQueryBuilder() {
Expand All @@ -766,6 +784,9 @@ public StructuredQuery<Entity> build() {
}
}

/**
* A StructuredQuery builder for queries that return Key results.
*/
public static final class KeyQueryBuilder extends BaseBuilder<Key, KeyQueryBuilder> {

KeyQueryBuilder() {
Expand All @@ -787,6 +808,9 @@ public StructuredQuery<Key> build() {
}
}

/**
* A StructuredQuery builder for projection queries.
*/
public static final class ProjectionEntityQueryBuilder
extends BaseBuilder<ProjectionEntity, ProjectionEntityQueryBuilder> {

Expand All @@ -804,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);
Expand All @@ -819,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);
Expand Down