Reorder methods: first the public methods, but getters. After, the gettes methods and at last, the private methods
Use of the keyword final in methods arguments for immutable types
Refactor the way constructors set attributes (the constructor with more args call the other that have less args)
Creation of the private method executeHttpRequest(BoundRequestBuilder): four methods execute the exactly same piece of code: extract method
Externalization of AuthUrls enum to a separated Java file -> com.mercadolibre.sdk.AuthUrls.java
Creation and externalization of constants (a lot of) in a separated Java file -> com.mercadolibre.sdk.Constants.java. This one have two inner classes
Creation of the private method getFromJson(JsonObject, String): extract method
Removing the private method hasRefreshToken(): not used (since before the refactor)
com.mercadolibre.sdk.MeliException.java:
Adding some constructors as Exception.
com.mercadolibre.sdk.AuthorizationFailure.java:
Renamed to AuthorizationFailureException.java.
Adding some constructor as Exception
I thought this class could extends MeliException instead of Exception, but I was not sure about this.. So I leave it the way it was
README.md:
The example of instantiation of Meli class was wrong. It doesn't compile this way. We need to force the first argument to Long: Meli m = new Meli(1234L, "a secret");
That is it!
About the externalization of the enum... Maybe it could keep in Meli.java as a inner enum. I don't know... When I look to the way we use this enum, I don't understand why it need to be a inner enum and not a separated Java file.
Oh, I forgot: this is my first (real) contribution in a open source project. Sorry if I made some mistakes. Feedbacks are welcome.
Well, there are some changes here:
com.mercadolibre.sdk.Meli.java
:final
in methods arguments for immutable typesexecuteHttpRequest(BoundRequestBuilder)
: four methods execute the exactly same piece of code: extract methodAuthUrls
enum to a separated Java file ->com.mercadolibre.sdk.AuthUrls.java
com.mercadolibre.sdk.Constants.java
. This one have two inner classesgetFromJson(JsonObject, String)
: extract methodhasRefreshToken()
: not used (since before the refactor)com.mercadolibre.sdk.MeliException.java
:Exception
.com.mercadolibre.sdk.AuthorizationFailure.java
:AuthorizationFailureException.java
.Exception
MeliException
instead ofException
, but I was not sure about this.. So I leave it the way it wasREADME.md
:The example of instantiation of
Meli
class was wrong. It doesn't compile this way. We need to force the first argument toLong
:Meli m = new Meli(1234L, "a secret");
That is it! About the externalization of the enum... Maybe it could keep in
Meli.java
as a inner enum. I don't know... When I look to the way we use this enum, I don't understand why it need to be a inner enum and not a separated Java file.Oh, I forgot: this is my first (real) contribution in a open source project. Sorry if I made some mistakes. Feedbacks are welcome.