Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #3891 - make reason a more idiomatic ErrorReason Android In…
Browse files Browse the repository at this point in the history
…tDef and remove unnecessary constructor
  • Loading branch information
zugaldia committed Feb 25, 2016
1 parent 4295d1b commit 9e7c3d3
Showing 1 changed file with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
package com.mapbox.mapboxsdk.offline;

import android.support.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* An Offline Region error
*/
public class OfflineRegionError {

/**
* Success = 1
* NotFound = 2
* Server = 3
* Connection = 4
* Other = 6
* Error code, self-explanatory.
*/
private int reason;
@IntDef({REASON_SUCCESS, REASON_NOT_FOUND, REASON_SERVER, REASON_CONNECTION, REASON_OTHER})
@Retention(RetentionPolicy.SOURCE)
public @interface ErrorReason {}

public static final int REASON_SUCCESS = 1;
public static final int REASON_NOT_FOUND = 2;
public static final int REASON_SERVER = 3;
public static final int REASON_CONNECTION = 4;
public static final int REASON_OTHER = 6;

private @ErrorReason int reason;

/**
/* An error message from the request handler, e.g. a server message or a system message
Expand All @@ -28,16 +39,11 @@ private OfflineRegionError() {
// For JNI use only
}

public OfflineRegionError(int reason, String message) {
this.reason = reason;
this.message = message;
}

/*
* Getters
*/

public int getReason() {
public @ErrorReason int getReason() {
return reason;
}

Expand Down

0 comments on commit 9e7c3d3

Please sign in to comment.