Skip to content

Commit

Permalink
refactor: document accessors, deprecate notifier proxy methods in fav…
Browse files Browse the repository at this point in the history
…our of accessing notifier direc
  • Loading branch information
fractalwrench committed Jun 19, 2018
1 parent f0eac1f commit 03d3998
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions sdk/src/main/java/com/bugsnag/android/Report.java
Expand Up @@ -13,11 +13,17 @@
* using your API key.
*/
public class Report implements JsonStream.Streamable {

@Nullable
private final File errorFile;

@Nullable
private Error error;
private Notifier notifier;
private final Error error;

@NonNull
private final Notifier notifier;

@NonNull
private String apiKey;

Report(@NonNull String apiKey, @Nullable File errorFile) {
Expand Down Expand Up @@ -51,11 +57,10 @@ public void toStream(@NonNull JsonStream writer) throws IOException {
// Write in-memory event
if (error != null) {
writer.value(error);
}

// Write on-disk event
if (errorFile != null) {
} else if (errorFile != null) { // Write on-disk event
writer.value(errorFile);
} else {
Logger.warn("Expected error or errorFile, found empty payload instead");
}

// End events array
Expand All @@ -70,20 +75,45 @@ public Error getError() {
return error;
}

/**
* Alters the API key used for this error report.
*
* @param apiKey the new API key
*/
public void setApiKey(@NonNull String apiKey) {
this.apiKey = apiKey;
}

/**
* @return the API key sent as part of this report.
*/
@NonNull
public String getApiKey() {
return apiKey;
}

@InternalApi
@Deprecated
public void setNotifierVersion(@NonNull String version) {
notifier.setVersion(version);
}

@InternalApi
@Deprecated
public void setNotifierName(@NonNull String name) {
notifier.setName(name);
}

@InternalApi
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
@Deprecated
public void setNotifierURL(@NonNull String url) {
notifier.setURL(url);
}

@InternalApi
@NonNull
public Notifier getNotifier() {
return notifier;
}
}

0 comments on commit 03d3998

Please sign in to comment.