forked from square/retrofit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This isn't the right granularity of data about an endpoint and we never exposed this anywhere in the actual library.
- Loading branch information
1 parent
fa3965f
commit 468e0ef
Showing
3 changed files
with
7 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,6 @@ | |
* @author Matt Hickman ([email protected]) | ||
*/ | ||
public interface Endpoint { | ||
|
||
/** The base API URL. */ | ||
String getUrl(); | ||
|
||
/** A name for differentiating between multiple API URLs. */ | ||
String getName(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,36 +6,15 @@ | |
* @author Matt Hickman ([email protected]) | ||
*/ | ||
public final class Endpoints { | ||
private static final String DEFAULT_NAME = "default"; | ||
|
||
private Endpoints() { | ||
} | ||
|
||
/** Create a server with the provided URL. */ | ||
public static Endpoint newFixedEndpoint(String url) { | ||
return new FixedEndpoint(url, DEFAULT_NAME); | ||
} | ||
|
||
/** Create an endpoint with the provided URL and name. */ | ||
public static Endpoint newFixedEndpoint(String url, String name) { | ||
return new FixedEndpoint(url, name); | ||
} | ||
|
||
private static class FixedEndpoint implements Endpoint { | ||
private final String apiUrl; | ||
private final String name; | ||
|
||
FixedEndpoint(String apiUrl, String name) { | ||
this.apiUrl = apiUrl; | ||
this.name = name; | ||
} | ||
|
||
@Override public String getUrl() { | ||
return apiUrl; | ||
} | ||
|
||
@Override public String getName() { | ||
return name; | ||
} | ||
public static Endpoint newFixedEndpoint(final String url) { | ||
return new Endpoint() { | ||
@Override public String getUrl() { | ||
return url; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters