Skip to content

Commit

Permalink
Remove the need for generated accessor methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton committed Mar 9, 2016
1 parent 57529fe commit 7bbbf19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions retrofit/src/main/java/retrofit2/ServiceMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
/** Adapts an invocation of an interface method into an HTTP call. */
final class ServiceMethod<T> {
// Upper and lower characters, digits, underscores, and hyphens, starting with a character.
private static final String PARAM = "[a-zA-Z][a-zA-Z0-9_-]*";
private static final Pattern PARAM_URL_REGEX = Pattern.compile("\\{(" + PARAM + ")\\}");
private static final Pattern PARAM_NAME_REGEX = Pattern.compile(PARAM);
static final String PARAM = "[a-zA-Z][a-zA-Z0-9_-]*";
static final Pattern PARAM_URL_REGEX = Pattern.compile("\\{(" + PARAM + ")\\}");
static final Pattern PARAM_NAME_REGEX = Pattern.compile(PARAM);

public final okhttp3.Call.Factory callFactory;
public final CallAdapter<?> callAdapter;
final okhttp3.Call.Factory callFactory;
final CallAdapter<?> callAdapter;

private final HttpUrl baseUrl;
private final Converter<ResponseBody, T> responseConverter;
Expand Down Expand Up @@ -90,7 +90,7 @@ final class ServiceMethod<T> {
}

/** Builds an HTTP request from method arguments. */
public Request toRequest(Object... args) throws IOException {
Request toRequest(Object... args) throws IOException {
RequestBuilder requestBuilder = new RequestBuilder(httpMethod, baseUrl, relativeUrl, headers,
contentType, hasBody, isFormEncoded, isMultipart);

Expand All @@ -111,7 +111,7 @@ public Request toRequest(Object... args) throws IOException {
}

/** Builds a method return value from an HTTP response body. */
public T toResponse(ResponseBody body) throws IOException {
T toResponse(ResponseBody body) throws IOException {
return responseConverter.convert(body);
}

Expand Down Expand Up @@ -668,7 +668,7 @@ static Set<String> parsePathParameters(String path) {
return patterns;
}

private static Class<?> boxIfPrimitive(Class<?> type) {
static Class<?> boxIfPrimitive(Class<?> type) {
if (boolean.class == type) return Boolean.class;
if (byte.class == type) return Byte.class;
if (char.class == type) return Character.class;
Expand Down
6 changes: 3 additions & 3 deletions retrofit/src/main/java/retrofit2/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import okio.Buffer;

final class Utils {
private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
static final Type[] EMPTY_TYPE_ARRAY = new Type[0];

private Utils() {
// No instances.
Expand Down Expand Up @@ -158,7 +158,7 @@ private static boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}

private static int hashCodeOrZero(Object o) {
static int hashCodeOrZero(Object o) {
return o != null ? o.hashCode() : 0;
}

Expand Down Expand Up @@ -274,7 +274,7 @@ private static Class<?> declaringClassOf(TypeVariable<?> typeVariable) {
return genericDeclaration instanceof Class ? (Class<?>) genericDeclaration : null;
}

private static void checkNotPrimitive(Type type) {
static void checkNotPrimitive(Type type) {
if (type instanceof Class<?> && ((Class<?>) type).isPrimitive()) {
throw new IllegalArgumentException();
}
Expand Down

0 comments on commit 7bbbf19

Please sign in to comment.