Skip to content

Commit 5e99922

Browse files
committed
Make deprecated methods call renamed ones
1 parent b7a5c2f commit 5e99922

32 files changed

Lines changed: 109 additions & 184 deletions

google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public final void delete(Key... keys) {
206206
@Override
207207
@Deprecated
208208
public boolean active() {
209-
return active;
209+
return isActive();
210210
}
211211

212212
@Override

google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ protected B setProperties(Map<String, Value<?>> properties) {
114114
*/
115115
@Deprecated
116116
public B key(K key) {
117-
this.key = key;
118-
return self();
117+
return setKey(key);
119118
}
120119

121120
/**
@@ -508,7 +507,7 @@ public boolean hasKey() {
508507
*/
509508
@Deprecated
510509
public K key() {
511-
return key;
510+
return getKey();
512511
}
513512

514513
/**
@@ -664,7 +663,7 @@ public Blob getBlob(String name) {
664663
*/
665664
@Deprecated
666665
public Set<String> names() {
667-
return properties.keySet();
666+
return getNames();
668667
}
669668

670669
/**

google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected abstract static class Builder<B extends Builder<B>> {
6868
projectId = copyFrom.getProjectId();
6969
namespace = copyFrom.getNamespace();
7070
ancestors = new LinkedList<>(copyFrom.getAncestors());
71-
kind = copyFrom.kind();
71+
kind = copyFrom.getKind();
7272
}
7373

7474
@SuppressWarnings("unchecked")
@@ -81,9 +81,7 @@ B self() {
8181
*/
8282
@Deprecated
8383
public B ancestors(PathElement ancestor) {
84-
Preconditions.checkState(ancestors.size() < MAX_PATH, "path can have at most 100 elements");
85-
ancestors.add(ancestor);
86-
return self();
84+
return addAncestor(ancestor);
8785
}
8886

8987
/**
@@ -100,7 +98,7 @@ public B addAncestor(PathElement ancestor) {
10098
*/
10199
@Deprecated
102100
public B ancestors(PathElement ancestor, PathElement... other) {
103-
return addAncestors(ImmutableList.<PathElement>builder().add(ancestor).add(other).build());
101+
return addAncestors(ancestor, other);
104102
}
105103

106104
/**
@@ -115,11 +113,7 @@ public B addAncestors(PathElement ancestor, PathElement... other) {
115113
*/
116114
@Deprecated
117115
public B ancestors(Iterable<PathElement> ancestors) {
118-
ImmutableList<PathElement> list = ImmutableList.copyOf(ancestors);
119-
Preconditions.checkState(this.ancestors.size() + list.size() < MAX_PATH,
120-
"path can have at most 100 elements");
121-
this.ancestors.addAll(list);
122-
return self();
116+
return addAncestors(ancestors);
123117
}
124118

125119
/**
@@ -138,8 +132,7 @@ public B addAncestors(Iterable<PathElement> ancestors) {
138132
*/
139133
@Deprecated
140134
public B kind(String kind) {
141-
this.kind = validateKind(kind);
142-
return self();
135+
return setKind(kind);
143136
}
144137

145138
/**
@@ -155,8 +148,7 @@ public B setKind(String kind) {
155148
*/
156149
@Deprecated
157150
public B projectId(String projectId) {
158-
this.projectId = validateDatabase(projectId);
159-
return self();
151+
return setProjectId(projectId);
160152
}
161153

162154
/**
@@ -172,8 +164,7 @@ public B setProjectId(String projectId) {
172164
*/
173165
@Deprecated
174166
public B namespace(String namespace) {
175-
this.namespace = validateNamespace(namespace);
176-
return self();
167+
return setNamespace(namespace);
177168
}
178169

179170
/**
@@ -199,7 +190,7 @@ public B setNamespace(String namespace) {
199190
*/
200191
@Deprecated
201192
public String projectId() {
202-
return projectId;
193+
return getProjectId();
203194
}
204195

205196
/**
@@ -214,7 +205,7 @@ public String getProjectId() {
214205
*/
215206
@Deprecated
216207
public String namespace() {
217-
return namespace;
208+
return getNamespace();
218209
}
219210

220211
/**
@@ -229,7 +220,7 @@ public String getNamespace() {
229220
*/
230221
@Deprecated
231222
public List<PathElement> ancestors() {
232-
return getPath().subList(0, getPath().size() - 1);
223+
return getAncestors();
233224
}
234225

235226
/**
@@ -244,7 +235,7 @@ public List<PathElement> getAncestors() {
244235
*/
245236
@Deprecated
246237
List<PathElement> path() {
247-
return path;
238+
return getPath();
248239
}
249240

250241
/**
@@ -263,14 +254,14 @@ PathElement getLeaf() {
263254
*/
264255
@Deprecated
265256
public String kind() {
266-
return getLeaf().kind();
257+
return getKind();
267258
}
268259

269260
/**
270261
* Returns the key's kind.
271262
*/
272263
public String getKind() {
273-
return getLeaf().kind();
264+
return getLeaf().getKind();
274265
}
275266

276267
@Deprecated

google-cloud-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public Batch.Response submit() {
7979
@Override
8080
@Deprecated
8181
public Datastore datastore() {
82-
return datastore;
82+
return getDatastore();
8383
}
8484

8585
@Override

google-cloud-datastore/src/main/java/com/google/cloud/datastore/Blob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public boolean equals(Object obj) {
7474
*/
7575
@Deprecated
7676
public int length() {
77-
return byteString.size();
77+
return getLength();
7878
}
7979

8080
/**

google-cloud-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static BlobValue of(Blob blob) {
7979

8080
@Deprecated
8181
public static Builder builder(Blob blob) {
82-
return new Builder().set(blob);
82+
return newBuilder(blob);
8383
}
8484

8585
public static Builder newBuilder(Blob blob) {

google-cloud-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static BooleanValue of(boolean value) {
7979

8080
@Deprecated
8181
public static Builder builder(boolean value) {
82-
return new Builder().set(value);
82+
return newBuilder(value);
8383
}
8484

8585
public static Builder newBuilder(boolean value) {

google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTime.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public boolean equals(Object obj) {
6868
*/
6969
@Deprecated
7070
public long timestampMicroseconds() {
71-
return timestampMicroseconds;
71+
return getTimestampMicroseconds();
7272
}
7373

7474
/**
@@ -83,7 +83,7 @@ public long getTimestampMicroseconds() {
8383
*/
8484
@Deprecated
8585
public long timestampMillis() {
86-
return timestampMicroseconds / 1000L;
86+
return getTimestampMillis();
8787
}
8888

8989
/**

google-cloud-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static DateTimeValue of(DateTime dateTime) {
8080

8181
@Deprecated
8282
public static Builder builder(DateTime dateTime) {
83-
return new Builder().set(dateTime);
83+
return newBuilder(dateTime);
8484
}
8585

8686
public static Builder newBuilder(DateTime dateTime) {

google-cloud-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static DoubleValue of(double value) {
7979

8080
@Deprecated
8181
public static Builder builder(double value) {
82-
return new Builder().set(value);
82+
return newBuilder(value);
8383
}
8484

8585
public static Builder newBuilder(double value) {

0 commit comments

Comments
 (0)