Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
DzmitryFomchyn authored and ahmedaly16 committed Mar 21, 2024
1 parent c04513e commit 4a7f780
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
*
* @since 5.4.0
*/
public class SingleElementSafeListTypeAdapter<E> extends TypeAdapter<List<E>> {
class SingleElementSafeListTypeAdapter<E> extends TypeAdapter<List<E>> {

/**
* A type adapter factory instance for serialization/deserialization.
*/
public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() {
static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() {

@Override
public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> typeToken) {
Expand All @@ -47,7 +47,7 @@ public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> typeToken)

@SuppressWarnings("unchecked")
final TypeAdapter<T> adapter =
(TypeAdapter<T>) new SingleElementSafeListTypeAdapter<>(elementTypeAdapter);
(TypeAdapter<T>) new SingleElementSafeListTypeAdapter<>(elementTypeAdapter);
return adapter;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.SerializedName;
import com.mapbox.api.geocoding.v6.models.V6FeatureType;
import com.mapbox.api.geocoding.v6.models.V6Worldview;
import com.mapbox.core.exceptions.ServicesException;
import com.mapbox.core.utils.TextUtils;
import com.mapbox.geojson.BoundingBox;
Expand Down Expand Up @@ -352,7 +353,7 @@ public Builder types(@NonNull @V6FeatureType.FeatureType String... types) {
* @return this builder for chaining options together
* @see <a href="https://docs.mapbox.com/api/search/geocoding-v6/#worldviews">Worldviews</a>
*/
public abstract Builder worldview(@NonNull String worldview);
public abstract Builder worldview(@V6Worldview.Worldview @NonNull String worldview);

/**
* Build a new {@link V6ForwardGeocodingRequestOptions} object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.SerializedName;
import com.mapbox.api.geocoding.v6.models.V6FeatureType;
import com.mapbox.api.geocoding.v6.models.V6Worldview;
import com.mapbox.core.utils.TextUtils;
import com.mapbox.geojson.GeometryAdapterFactory;
import com.mapbox.geojson.Point;
Expand Down Expand Up @@ -198,7 +199,7 @@ public Builder types(@NonNull @V6FeatureType.FeatureType String... types) {
* @return this builder for chaining options together
* @see <a href="https://docs.mapbox.com/api/search/geocoding-v6/#worldviews">Worldviews</a>
*/
public abstract Builder worldview(@NonNull String worldview);
public abstract Builder worldview(@V6Worldview.Worldview @NonNull String worldview);

/**
* Build a new {@link V6ReverseGeocodingRequestOptions} object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @see <a href="https://docs.mapbox.com/api/search/geocoding-v6/#the-context-object">The Context Object</a>
*/
@AutoValue
public abstract class V6Context extends V6Object {
public abstract class V6Context extends V6JsonObject {

/**
* Address context element.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @see <a href="https://docs.mapbox.com/api/search/geocoding-v6/#the-context-object">The Context Object</a>
*/
@AutoValue
public abstract class V6ContextElement extends V6Object {
public abstract class V6ContextElement extends V6JsonObject {

/**
* Element id. This id can be queried directly via a forward geocoding search to traverse into
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* A type which contains a description for returned by the Geocoding V6 API object.
*/
@AutoValue
public abstract class V6Feature extends V6Object {
public abstract class V6Feature extends V6JsonObject {

/**
* Feature id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Base class for V6 types.
*/
public abstract class V6Object implements Serializable {
public abstract class V6JsonObject implements Serializable {

/**
* Use this method to get JSON properties that weren't recognized during JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @see <a href="https://docs.mapbox.com/api/search/geocoding-v6/#smart-address-match">Smart Address Match</a>
*/
@AutoValue
public abstract class V6MatchCode extends V6Object {
public abstract class V6MatchCode extends V6JsonObject {

/**
* Match code for address number.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* A type which contains the majority of information returned by the Geocoding V6 API.
*/
@AutoValue
public abstract class V6Properties extends V6Object {
public abstract class V6Properties extends V6JsonObject {

/**
* Feature id.
Expand All @@ -31,6 +31,7 @@ public abstract class V6Properties extends V6Object {
* @return a string describing the type of the feature
*/
@NonNull
@V6FeatureType.FeatureType
@SerializedName("feature_type")
public abstract String featureType();

Expand Down

0 comments on commit 4a7f780

Please sign in to comment.