diff options
Diffstat (limited to 'java/com/android/dialer/spam/status')
-rw-r--r-- | java/com/android/dialer/spam/status/SimpleSpamStatus.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/java/com/android/dialer/spam/status/SimpleSpamStatus.java b/java/com/android/dialer/spam/status/SimpleSpamStatus.java index ff080ed1d..5f45c1a4f 100644 --- a/java/com/android/dialer/spam/status/SimpleSpamStatus.java +++ b/java/com/android/dialer/spam/status/SimpleSpamStatus.java @@ -26,7 +26,11 @@ public abstract class SimpleSpamStatus implements SpamStatus { /** Returns a SimpleSpamStatus with the given boolean and timestamp. */ public static SimpleSpamStatus create(boolean isSpam, @Nullable Long timestampMillis) { - return new AutoValue_SimpleSpamStatus(isSpam, Optional.fromNullable(timestampMillis)); + return builder() + .setSpam(isSpam) + .setTimestampMillis(timestampMillis) + .setSpamMetadata(SpamMetadata.empty()) + .build(); } /** Returns a SimpleSpamStatus that's not marked as spam and has no timestamp. */ @@ -34,9 +38,23 @@ public abstract class SimpleSpamStatus implements SpamStatus { return create(false, null); } - /** Returns an empty {@link SpamMetadata}. */ - @Override - public final SpamMetadata getSpamMetadata() { - return SpamMetadata.empty(); + public static Builder builder() { + return new AutoValue_SimpleSpamStatus.Builder(); + } + + /** Creates instances of SimpleSpamStatus. */ + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder setSpam(boolean isSpam); + + abstract Builder setTimestampMillis(Optional<Long> timestamp); + + public Builder setTimestampMillis(@Nullable Long timestampMillis) { + return setTimestampMillis(Optional.fromNullable(timestampMillis)); + } + + public abstract Builder setSpamMetadata(SpamMetadata spamMetadata); + + public abstract SimpleSpamStatus build(); } } |