Skip to content

Commit

Permalink
Make deprecated methods call renamed ones
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Oct 14, 2016
1 parent b7a5c2f commit 5e99922
Show file tree
Hide file tree
Showing 32 changed files with 109 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public final void delete(Key... keys) {
@Override
@Deprecated
public boolean active() {
return active;
return isActive();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ protected B setProperties(Map<String, Value<?>> properties) {
*/
@Deprecated
public B key(K key) {
this.key = key;
return self();
return setKey(key);
}

/**
Expand Down Expand Up @@ -508,7 +507,7 @@ public boolean hasKey() {
*/
@Deprecated
public K key() {
return key;
return getKey();
}

/**
Expand Down Expand Up @@ -664,7 +663,7 @@ public Blob getBlob(String name) {
*/
@Deprecated
public Set<String> names() {
return properties.keySet();
return getNames();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected abstract static class Builder<B extends Builder<B>> {
projectId = copyFrom.getProjectId();
namespace = copyFrom.getNamespace();
ancestors = new LinkedList<>(copyFrom.getAncestors());
kind = copyFrom.kind();
kind = copyFrom.getKind();
}

@SuppressWarnings("unchecked")
Expand All @@ -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);
}

/**
Expand All @@ -100,7 +98,7 @@ public B addAncestor(PathElement ancestor) {
*/
@Deprecated
public B ancestors(PathElement ancestor, PathElement... other) {
return addAncestors(ImmutableList.<PathElement>builder().add(ancestor).add(other).build());
return addAncestors(ancestor, other);
}

/**
Expand All @@ -115,11 +113,7 @@ public B addAncestors(PathElement ancestor, PathElement... other) {
*/
@Deprecated
public B ancestors(Iterable<PathElement> ancestors) {
ImmutableList<PathElement> 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);
}

/**
Expand All @@ -138,8 +132,7 @@ public B addAncestors(Iterable<PathElement> ancestors) {
*/
@Deprecated
public B kind(String kind) {
this.kind = validateKind(kind);
return self();
return setKind(kind);
}

/**
Expand All @@ -155,8 +148,7 @@ public B setKind(String kind) {
*/
@Deprecated
public B projectId(String projectId) {
this.projectId = validateDatabase(projectId);
return self();
return setProjectId(projectId);
}

/**
Expand All @@ -172,8 +164,7 @@ public B setProjectId(String projectId) {
*/
@Deprecated
public B namespace(String namespace) {
this.namespace = validateNamespace(namespace);
return self();
return setNamespace(namespace);
}

/**
Expand All @@ -199,7 +190,7 @@ public B setNamespace(String namespace) {
*/
@Deprecated
public String projectId() {
return projectId;
return getProjectId();
}

/**
Expand All @@ -214,7 +205,7 @@ public String getProjectId() {
*/
@Deprecated
public String namespace() {
return namespace;
return getNamespace();
}

/**
Expand All @@ -229,7 +220,7 @@ public String getNamespace() {
*/
@Deprecated
public List<PathElement> ancestors() {
return getPath().subList(0, getPath().size() - 1);
return getAncestors();
}

/**
Expand All @@ -244,7 +235,7 @@ public List<PathElement> getAncestors() {
*/
@Deprecated
List<PathElement> path() {
return path;
return getPath();
}

/**
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Batch.Response submit() {
@Override
@Deprecated
public Datastore datastore() {
return datastore;
return getDatastore();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public boolean equals(Object obj) {
*/
@Deprecated
public int length() {
return byteString.size();
return getLength();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public boolean equals(Object obj) {
*/
@Deprecated
public long timestampMicroseconds() {
return timestampMicroseconds;
return getTimestampMicroseconds();
}

/**
Expand All @@ -83,7 +83,7 @@ public long getTimestampMicroseconds() {
*/
@Deprecated
public long timestampMillis() {
return timestampMicroseconds / 1000L;
return getTimestampMillis();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,7 +83,7 @@ static Entity convert(FullEntity<Key> from) {

@Deprecated
public static Builder builder(Key key) {
return new Builder(key);
return newBuilder(key);
}

public static Builder newBuilder(Key key) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public FullEntity<K> build() {

@Deprecated
public static Builder<IncompleteKey> builder() {
return new Builder<>();
return newBuilder();
}

public static Builder<IncompleteKey> newBuilder() {
Expand All @@ -62,7 +62,7 @@ public static Builder<IncompleteKey> newBuilder() {

@Deprecated
public static <K extends IncompleteKey> Builder<K> builder(K key) {
return new Builder<>(key);
return newBuilder(key);
}

public static <K extends IncompleteKey> Builder<K> newBuilder(K key) {
Expand All @@ -71,7 +71,7 @@ public static <K extends IncompleteKey> Builder<K> newBuilder(K key) {

@Deprecated
public static <K extends IncompleteKey> Builder<K> builder(FullEntity<K> copyFrom) {
return new Builder<>(copyFrom);
return newBuilder(copyFrom);
}

public static <K extends IncompleteKey> Builder<K> newBuilder(FullEntity<K> copyFrom) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ public static final class Builder<V> {
*/
@Deprecated
public Builder<V> query(String query) {
queryString = checkNotNull(query);
return this;
return setQuery(query);
}

/**
Expand All @@ -183,8 +182,7 @@ public Builder<V> setQuery(String query) {
*/
@Deprecated
public Builder<V> namespace(String namespace) {
this.namespace = validateNamespace(namespace);
return this;
return setNamespace(namespace);
}

/**
Expand All @@ -201,8 +199,7 @@ public Builder<V> setNamespace(String namespace) {
*/
@Deprecated
public Builder<V> allowLiteral(boolean allowLiteral) {
this.allowLiteral = allowLiteral;
return this;
return setAllowLiteral(allowLiteral);
}

/**
Expand Down Expand Up @@ -347,7 +344,7 @@ private GqlQuery(Builder<V> builder) {
*/
@Deprecated
public String queryString() {
return queryString;
return getQueryString();
}

/**
Expand All @@ -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<String, Object> namedBindings() {
ImmutableMap.Builder<String, Object> builder = ImmutableSortedMap.naturalOrder();
for (Map.Entry<String, Binding> binding : namedBindings.entrySet()) {
builder.put(binding.getKey(), binding.getValue().getCursorOrValue());
}
return builder.build();
return getNamedBindings();
}

/**
Expand All @@ -402,11 +386,7 @@ public Map<String, Object> getNamedBindings() {
*/
@Deprecated
public List<Object> numberArgs() {
ImmutableList.Builder<Object> builder = ImmutableList.builder();
for (Binding binding : positionalBindings) {
builder.add(binding.getCursorOrValue());
}
return builder.build();
return getNumberArgs();
}

/**
Expand Down
Loading

0 comments on commit 5e99922

Please sign in to comment.