diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java index 206c5d30679c..6a69e271fc32 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java @@ -206,7 +206,7 @@ public final void delete(Key... keys) { @Override @Deprecated public boolean active() { - return active; + return isActive(); } @Override diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java index c4e4c558381e..b41507158bba 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java @@ -114,8 +114,7 @@ protected B setProperties(Map> properties) { */ @Deprecated public B key(K key) { - this.key = key; - return self(); + return setKey(key); } /** @@ -508,7 +507,7 @@ public boolean hasKey() { */ @Deprecated public K key() { - return key; + return getKey(); } /** @@ -664,7 +663,7 @@ public Blob getBlob(String name) { */ @Deprecated public Set names() { - return properties.keySet(); + return getNames(); } /** diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java index 4d59ed3c5ce3..7736660b56a5 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java @@ -68,7 +68,7 @@ protected abstract static class Builder> { projectId = copyFrom.getProjectId(); namespace = copyFrom.getNamespace(); ancestors = new LinkedList<>(copyFrom.getAncestors()); - kind = copyFrom.kind(); + kind = copyFrom.getKind(); } @SuppressWarnings("unchecked") @@ -81,9 +81,7 @@ B self() { */ @Deprecated public B ancestors(PathElement ancestor) { - Preconditions.checkState(ancestors.size() < MAX_PATH, "path can have at most 100 elements"); - ancestors.add(ancestor); - return self(); + return addAncestor(ancestor); } /** @@ -100,7 +98,7 @@ public B addAncestor(PathElement ancestor) { */ @Deprecated public B ancestors(PathElement ancestor, PathElement... other) { - return addAncestors(ImmutableList.builder().add(ancestor).add(other).build()); + return addAncestors(ancestor, other); } /** @@ -115,11 +113,7 @@ public B addAncestors(PathElement ancestor, PathElement... other) { */ @Deprecated public B ancestors(Iterable ancestors) { - ImmutableList list = ImmutableList.copyOf(ancestors); - Preconditions.checkState(this.ancestors.size() + list.size() < MAX_PATH, - "path can have at most 100 elements"); - this.ancestors.addAll(list); - return self(); + return addAncestors(ancestors); } /** @@ -138,8 +132,7 @@ public B addAncestors(Iterable ancestors) { */ @Deprecated public B kind(String kind) { - this.kind = validateKind(kind); - return self(); + return setKind(kind); } /** @@ -155,8 +148,7 @@ public B setKind(String kind) { */ @Deprecated public B projectId(String projectId) { - this.projectId = validateDatabase(projectId); - return self(); + return setProjectId(projectId); } /** @@ -172,8 +164,7 @@ public B setProjectId(String projectId) { */ @Deprecated public B namespace(String namespace) { - this.namespace = validateNamespace(namespace); - return self(); + return setNamespace(namespace); } /** @@ -199,7 +190,7 @@ public B setNamespace(String namespace) { */ @Deprecated public String projectId() { - return projectId; + return getProjectId(); } /** @@ -214,7 +205,7 @@ public String getProjectId() { */ @Deprecated public String namespace() { - return namespace; + return getNamespace(); } /** @@ -229,7 +220,7 @@ public String getNamespace() { */ @Deprecated public List ancestors() { - return getPath().subList(0, getPath().size() - 1); + return getAncestors(); } /** @@ -244,7 +235,7 @@ public List getAncestors() { */ @Deprecated List path() { - return path; + return getPath(); } /** @@ -263,14 +254,14 @@ PathElement getLeaf() { */ @Deprecated public String kind() { - return getLeaf().kind(); + return getKind(); } /** * Returns the key's kind. */ public String getKind() { - return getLeaf().kind(); + return getLeaf().getKind(); } @Deprecated diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java index 3ca05bc92ad3..e979b54f4d20 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java @@ -79,7 +79,7 @@ public Batch.Response submit() { @Override @Deprecated public Datastore datastore() { - return datastore; + return getDatastore(); } @Override diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Blob.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Blob.java index 325e5d2ec8cf..3d5ad6ff374b 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Blob.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Blob.java @@ -74,7 +74,7 @@ public boolean equals(Object obj) { */ @Deprecated public int length() { - return byteString.size(); + return getLength(); } /** diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java index 7fd37da3d0af..1023ddfbee29 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java @@ -79,7 +79,7 @@ public static BlobValue of(Blob blob) { @Deprecated public static Builder builder(Blob blob) { - return new Builder().set(blob); + return newBuilder(blob); } public static Builder newBuilder(Blob blob) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java index c011ccd7b838..c0339df6ab17 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java @@ -79,7 +79,7 @@ public static BooleanValue of(boolean value) { @Deprecated public static Builder builder(boolean value) { - return new Builder().set(value); + return newBuilder(value); } public static Builder newBuilder(boolean value) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTime.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTime.java index 84be14e5b9a9..666b4b948ae5 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTime.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTime.java @@ -68,7 +68,7 @@ public boolean equals(Object obj) { */ @Deprecated public long timestampMicroseconds() { - return timestampMicroseconds; + return getTimestampMicroseconds(); } /** @@ -83,7 +83,7 @@ public long getTimestampMicroseconds() { */ @Deprecated public long timestampMillis() { - return timestampMicroseconds / 1000L; + return getTimestampMillis(); } /** diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java index b7789bf42f3b..04226cc1e638 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java @@ -80,7 +80,7 @@ public static DateTimeValue of(DateTime dateTime) { @Deprecated public static Builder builder(DateTime dateTime) { - return new Builder().set(dateTime); + return newBuilder(dateTime); } public static Builder newBuilder(DateTime dateTime) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java index 6e17883f1cab..4d94be69190c 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java @@ -79,7 +79,7 @@ public static DoubleValue of(double value) { @Deprecated public static Builder builder(double value) { - return new Builder().set(value); + return newBuilder(value); } public static Builder newBuilder(double value) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Entity.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Entity.java index 69f7dc61a781..2fa562794e3f 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Entity.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Entity.java @@ -49,8 +49,7 @@ private Builder(Key key, FullEntity entity) { @Override @Deprecated public Builder key(Key key) { - super.setKey(checkNotNull(key)); - return this; + return setKey(key); } @Override @@ -84,7 +83,7 @@ static Entity convert(FullEntity from) { @Deprecated public static Builder builder(Key key) { - return new Builder(key); + return newBuilder(key); } public static Builder newBuilder(Key key) { @@ -93,7 +92,7 @@ public static Builder newBuilder(Key key) { @Deprecated public static Builder builder(Entity copyFrom) { - return new Builder(copyFrom); + return newBuilder(copyFrom); } public static Builder newBuilder(Entity copyFrom) { @@ -102,7 +101,7 @@ public static Builder newBuilder(Entity copyFrom) { @Deprecated public static Builder builder(Key key, FullEntity copyFrom) { - return new Builder(key, copyFrom); + return newBuilder(key, copyFrom); } public static Builder newBuilder(Key key, FullEntity copyFrom) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/EntityValue.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/EntityValue.java index 11aa1fb8f378..b6d0e560e5bd 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/EntityValue.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/EntityValue.java @@ -79,7 +79,7 @@ public static EntityValue of(FullEntity entity) { @Deprecated public static Builder builder(FullEntity entity) { - return new Builder().set(entity); + return newBuilder(entity); } public static Builder newBuilder(FullEntity entity) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/FullEntity.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/FullEntity.java index aa7ef3ce6ef8..49793c13538e 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/FullEntity.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/FullEntity.java @@ -53,7 +53,7 @@ public FullEntity build() { @Deprecated public static Builder builder() { - return new Builder<>(); + return newBuilder(); } public static Builder newBuilder() { @@ -62,7 +62,7 @@ public static Builder newBuilder() { @Deprecated public static Builder builder(K key) { - return new Builder<>(key); + return newBuilder(key); } public static Builder newBuilder(K key) { @@ -71,7 +71,7 @@ public static Builder newBuilder(K key) { @Deprecated public static Builder builder(FullEntity copyFrom) { - return new Builder<>(copyFrom); + return newBuilder(copyFrom); } public static Builder newBuilder(FullEntity copyFrom) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java index 4627d0d55a70..0dd482e086b4 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java @@ -166,8 +166,7 @@ public static final class Builder { */ @Deprecated public Builder query(String query) { - queryString = checkNotNull(query); - return this; + return setQuery(query); } /** @@ -183,8 +182,7 @@ public Builder setQuery(String query) { */ @Deprecated public Builder namespace(String namespace) { - this.namespace = validateNamespace(namespace); - return this; + return setNamespace(namespace); } /** @@ -201,8 +199,7 @@ public Builder setNamespace(String namespace) { */ @Deprecated public Builder allowLiteral(boolean allowLiteral) { - this.allowLiteral = allowLiteral; - return this; + return setAllowLiteral(allowLiteral); } /** @@ -347,7 +344,7 @@ private GqlQuery(Builder builder) { */ @Deprecated public String queryString() { - return queryString; + return getQueryString(); } /** @@ -361,29 +358,16 @@ public String getQueryString() { * Returns whether the query string can contain literals. When {@code false}, the query string * must not contain any literals and instead must bind all values. */ - @Deprecated public boolean allowLiteral() { return allowLiteral; } - /** - * Returns whether the query string can contain literals. When {@code false}, the query string - * must not contain any literals and instead must bind all values. - */ - public boolean getAllowLiteral() { - return allowLiteral; - } - /** * Returns an immutable map of named bindings. */ @Deprecated public Map namedBindings() { - ImmutableMap.Builder builder = ImmutableSortedMap.naturalOrder(); - for (Map.Entry binding : namedBindings.entrySet()) { - builder.put(binding.getKey(), binding.getValue().getCursorOrValue()); - } - return builder.build(); + return getNamedBindings(); } /** @@ -402,11 +386,7 @@ public Map getNamedBindings() { */ @Deprecated public List numberArgs() { - ImmutableList.Builder builder = ImmutableList.builder(); - for (Binding binding : positionalBindings) { - builder.add(binding.getCursorOrValue()); - } - return builder.build(); + return getNumberArgs(); } /** diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/IncompleteKey.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/IncompleteKey.java index d786f17f8aa1..332642b4846a 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/IncompleteKey.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/IncompleteKey.java @@ -79,22 +79,7 @@ static IncompleteKey fromPb(com.google.datastore.v1.Key keyPb) { @Override @Deprecated public Key parent() { - List ancestors = getAncestors(); - if (ancestors.isEmpty()) { - return null; - } - PathElement parent = ancestors.get(ancestors.size() - 1); - Key.Builder keyBuilder; - if (parent.hasName()) { - keyBuilder = Key.newBuilder(getProjectId(), parent.kind(), parent.name()); - } else { - keyBuilder = Key.newBuilder(getProjectId(), parent.kind(), parent.id()); - } - String namespace = getNamespace(); - if (namespace != null) { - keyBuilder.setNamespace(namespace); - } - return keyBuilder.addAncestors(ancestors.subList(0, ancestors.size() - 1)).build(); + return getParent(); } /** @@ -109,9 +94,9 @@ public Key getParent() { PathElement parent = ancestors.get(ancestors.size() - 1); Key.Builder keyBuilder; if (parent.hasName()) { - keyBuilder = Key.newBuilder(getProjectId(), parent.kind(), parent.name()); + keyBuilder = Key.newBuilder(getProjectId(), parent.getKind(), parent.getName()); } else { - keyBuilder = Key.newBuilder(getProjectId(), parent.kind(), parent.id()); + keyBuilder = Key.newBuilder(getProjectId(), parent.getKind(), parent.getId()); } String namespace = getNamespace(); if (namespace != null) { @@ -122,7 +107,7 @@ public Key getParent() { @Deprecated public static Builder builder(String projectId, String kind) { - return new Builder(projectId, kind); + return newBuilder(projectId, kind); } public static Builder newBuilder(String projectId, String kind) { @@ -131,7 +116,7 @@ public static Builder newBuilder(String projectId, String kind) { @Deprecated public static Builder builder(IncompleteKey copyFrom) { - return new Builder(copyFrom); + return newBuilder(copyFrom); } public static Builder newBuilder(IncompleteKey copyFrom) { @@ -140,9 +125,7 @@ public static Builder newBuilder(IncompleteKey copyFrom) { @Deprecated public static Builder builder(Key parent, String kind) { - return newBuilder(parent.getProjectId(), kind) - .setNamespace(parent.getNamespace()) - .addAncestors(parent.getPath()); + return newBuilder(parent, kind); } public static Builder newBuilder(Key parent, String kind) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java index 18d579b11cab..4bc216d88581 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java @@ -77,9 +77,7 @@ private Builder(Key copyFrom) { */ @Deprecated public Builder name(String name) { - this.name = name; - id = null; - return this; + return setName(name); } /** @@ -96,9 +94,7 @@ public Builder setName(String name) { */ @Deprecated public Builder id(long id) { - this.id = id; - name = null; - return this; + return setId(id); } /** @@ -137,14 +133,14 @@ public boolean hasId() { */ @Deprecated public Long id() { - return getLeaf().id(); + return getId(); } /** * Returns the key's id or {@code null} if it has a name instead. */ public Long getId() { - return getLeaf().id(); + return getLeaf().getId(); } public boolean hasName() { @@ -156,14 +152,14 @@ public boolean hasName() { */ @Deprecated public String name() { - return getLeaf().name(); + return getName(); } /** * Returns the key's name or {@code null} if it has an id instead. */ public String getName() { - return getLeaf().name(); + return getLeaf().getName(); } /** @@ -218,7 +214,7 @@ static Key fromPb(com.google.datastore.v1.Key keyPb) { @Deprecated public static Builder builder(String projectId, String kind, String name) { - return new Builder(projectId, kind, name); + return newBuilder(projectId, kind, name); } public static Builder newBuilder(String projectId, String kind, String name) { @@ -227,7 +223,7 @@ public static Builder newBuilder(String projectId, String kind, String name) { @Deprecated public static Builder builder(String projectId, String kind, long id) { - return new Builder(projectId, kind, id); + return newBuilder(projectId, kind, id); } public static Builder newBuilder(String projectId, String kind, long id) { @@ -236,7 +232,7 @@ public static Builder newBuilder(String projectId, String kind, long id) { @Deprecated public static Builder builder(Key copyFrom) { - return new Builder(copyFrom); + return newBuilder(copyFrom); } public static Builder newBuilder(Key copyFrom) { @@ -245,7 +241,7 @@ public static Builder newBuilder(Key copyFrom) { @Deprecated public static Builder builder(IncompleteKey copyFrom, String name) { - return new Builder(copyFrom, name); + return newBuilder(copyFrom, name); } public static Builder newBuilder(IncompleteKey copyFrom, String name) { @@ -254,7 +250,7 @@ public static Builder newBuilder(IncompleteKey copyFrom, String name) { @Deprecated public static Builder builder(IncompleteKey copyFrom, long id) { - return new Builder(copyFrom, id); + return newBuilder(copyFrom, id); } public static Builder newBuilder(IncompleteKey copyFrom, long id) { @@ -263,9 +259,7 @@ public static Builder newBuilder(IncompleteKey copyFrom, long id) { @Deprecated public static Builder builder(Key parent, String kind, String name) { - Builder builder = newBuilder(parent.getProjectId(), kind, name); - addParentToBuilder(parent, builder); - return builder; + return newBuilder(parent, kind, name); } public static Builder newBuilder(Key parent, String kind, String name) { @@ -276,9 +270,7 @@ public static Builder newBuilder(Key parent, String kind, String name) { @Deprecated public static Builder builder(Key parent, String kind, long id) { - Builder builder = newBuilder(parent.getProjectId(), kind, id); - addParentToBuilder(parent, builder); - return builder; + return newBuilder(parent, kind, id); } public static Builder newBuilder(Key parent, String kind, long id) { @@ -291,9 +283,9 @@ private static void addParentToBuilder(Key parent, Builder builder) { builder.setNamespace(parent.getNamespace()); builder.addAncestors(parent.getAncestors()); if (parent.hasId()) { - builder.addAncestors(PathElement.of(parent.kind(), parent.getId())); + builder.addAncestors(PathElement.of(parent.getKind(), parent.getId())); } else { - builder.addAncestors(PathElement.of(parent.kind(), parent.getName())); + builder.addAncestors(PathElement.of(parent.getKind(), parent.getName())); } } } diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/KeyQuery.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/KeyQuery.java index ec21397cc7ae..266c1e952812 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/KeyQuery.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/KeyQuery.java @@ -38,13 +38,13 @@ public static final class Builder extends StructuredQuery.BuilderImpl resultClass() { - return actualResultType.resultClass(); + return getResultClass(); } @Override @@ -117,7 +117,7 @@ public Class getResultClass() { @Override @Deprecated public Cursor cursorAfter() { - return new Cursor(cursor); + return getCursorAfter(); } @Override diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StringValue.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StringValue.java index 4891630e0c20..92dc0e981e7e 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StringValue.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StringValue.java @@ -79,7 +79,7 @@ public static StringValue of(String value) { @Deprecated public static Builder builder(String value) { - return new Builder().set(value); + return newBuilder(value); } public static Builder newBuilder(String value) { diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java index a185a9681527..988a0326d4e2 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java @@ -502,7 +502,7 @@ public boolean equals(Object obj) { */ @Deprecated public String property() { - return property; + return getProperty(); } /** @@ -517,7 +517,7 @@ public String getProperty() { */ @Deprecated public Direction direction() { - return direction; + return getDirection(); } /** @@ -701,8 +701,7 @@ B self() { @Override @Deprecated public B namespace(String namespace) { - this.namespace = namespace; - return self(); + return setNamespace(namespace); } @Override @@ -714,8 +713,7 @@ public B setNamespace(String namespace) { @Override @Deprecated public B kind(String kind) { - this.kind = kind; - return self(); + return setKind(kind); } @Override @@ -727,8 +725,7 @@ public B setKind(String kind) { @Override @Deprecated public B startCursor(Cursor startCursor) { - this.startCursor = startCursor; - return self(); + return setStartCursor(startCursor); } @Override @@ -740,8 +737,7 @@ public B setStartCursor(Cursor startCursor) { @Override @Deprecated public B endCursor(Cursor endCursor) { - this.endCursor = endCursor; - return self(); + return setEndCursor(endCursor); } @Override @@ -753,9 +749,7 @@ public B setEndCursor(Cursor endCursor) { @Override @Deprecated public B offset(int offset) { - Preconditions.checkArgument(offset >= 0, "offset must not be negative"); - this.offset = offset; - return self(); + return setOffset(offset); } @Override @@ -768,9 +762,7 @@ public B setOffset(int offset) { @Override @Deprecated public B limit(Integer limit) { - Preconditions.checkArgument(limit == null || limit > 0, "limit must be positive"); - this.limit = limit; - return self(); + return setLimit(limit); } @Override @@ -783,8 +775,7 @@ public B setLimit(Integer limit) { @Override @Deprecated public B filter(Filter filter) { - this.filter = filter; - return self(); + return setFilter(filter); } @Override @@ -802,9 +793,7 @@ public B clearOrderBy() { @Override @Deprecated public B orderBy(OrderBy orderBy, OrderBy... others) { - clearOrderBy(); - addOrderBy(orderBy, others); - return self(); + return setOrderBy(orderBy, others); } @Override @@ -828,9 +817,7 @@ B clearProjection() { @Deprecated B projection(String projection, String... others) { - clearProjection(); - addProjection(projection, others); - return self(); + return setProjection(projection, others); } B setProjection(String projection, String... others) { @@ -852,9 +839,7 @@ B clearDistinctOn() { @Deprecated B distinctOn(String property, String... others) { - clearDistinctOn(); - addDistinctOn(property, others); - return self(); + return setDistinctOn(property, others); } B setDistinctOn(String property, String... others) { @@ -963,7 +948,7 @@ public boolean equals(Object obj) { */ @Deprecated public String kind() { - return kind; + return getKind(); } /** @@ -982,7 +967,7 @@ boolean isKeyOnly() { */ @Deprecated public List projection() { - return projection; + return getProjection(); } /** @@ -997,7 +982,7 @@ public List getProjection() { */ @Deprecated public Filter filter() { - return filter; + return getFilter(); } /** @@ -1012,7 +997,7 @@ public Filter getFilter() { */ @Deprecated public List distinctOn() { - return distinctOn; + return getDistinctOn(); } /** @@ -1027,7 +1012,7 @@ public List getDistinctOn() { */ @Deprecated public ImmutableList orderBy() { - return orderBy; + return getOrderBy(); } /** @@ -1042,7 +1027,7 @@ public ImmutableList getOrderBy() { */ @Deprecated public Cursor startCursor() { - return startCursor; + return getStartCursor(); } /** @@ -1057,7 +1042,7 @@ public Cursor getStartCursor() { */ @Deprecated public Cursor endCursor() { - return endCursor; + return getEndCursor(); } /** @@ -1072,7 +1057,7 @@ public Cursor getEndCursor() { */ @Deprecated public int offset() { - return offset; + return getOffset(); } /** @@ -1087,7 +1072,7 @@ public int getOffset() { */ @Deprecated public Integer limit() { - return limit; + return getLimit(); } /** diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java index 8c227f0c8ebd..150799932591 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java @@ -125,8 +125,9 @@ public void rollback() { } @Override + @Deprecated public Datastore datastore() { - return datastore; + return getDatastore(); } @Override diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Value.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Value.java index e33ab137c733..92543d9522c3 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Value.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Value.java @@ -103,7 +103,7 @@ public B mergeFrom(P other) { @Override @Deprecated public boolean getExcludeFromIndexes() { - return excludeFromIndexes; + return excludeFromIndexes(); } @Override @@ -114,8 +114,7 @@ public boolean excludeFromIndexes() { @Override @Deprecated public B excludeFromIndexes(boolean excludeFromIndexes) { - this.excludeFromIndexes = excludeFromIndexes; - return self(); + return setExcludeFromIndexes(excludeFromIndexes); } @Override @@ -124,7 +123,6 @@ public B setExcludeFromIndexes(boolean excludeFromIndexes) { return self(); } - @Deprecated @Override public int getMeaning() { @@ -134,8 +132,7 @@ public int getMeaning() { @Deprecated @Override public B meaning(int meaning) { - this.meaning = meaning; - return self(); + return setMeaning(meaning); } @Deprecated @@ -168,7 +165,7 @@ private B self() { @SuppressWarnings("deprecation")

, B extends BaseBuilder> Value(ValueBuilder builder) { valueType = builder.getValueType(); - excludeFromIndexes = builder.getExcludeFromIndexes(); + excludeFromIndexes = builder.excludeFromIndexes(); meaning = builder.getMeaning(); value = builder.get(); } @@ -178,7 +175,7 @@

, B extends BaseBuilder> Value(ValueBuilder */ @Deprecated public final ValueType type() { - return valueType; + return getType(); } /** @@ -197,7 +194,7 @@ public final boolean excludeFromIndexes() { @Deprecated final int meaning() { - return meaning; + return getMeaning(); } @Deprecated diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java index c112479356e8..cf7f47b8c853 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java @@ -650,7 +650,7 @@ private DatastoreOptions.Builder optionsBuilder() { */ @Deprecated public DatastoreOptions options() { - return optionsBuilder().build(); + return getOptions(); } /**