Commit a68bb38a by samrobinson Committed by Ian Baker

Change MediaMetadata private constructor to take the Builder.

PiperOrigin-RevId: 364580585
parent 2c76bc5a
...@@ -39,7 +39,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -39,7 +39,7 @@ public final class MediaMetadata implements Bundleable {
/** Returns a new {@link MediaMetadata} instance with the current builder values. */ /** Returns a new {@link MediaMetadata} instance with the current builder values. */
public MediaMetadata build() { public MediaMetadata build() {
return new MediaMetadata(title); return new MediaMetadata(this);
} }
} }
...@@ -49,8 +49,8 @@ public final class MediaMetadata implements Bundleable { ...@@ -49,8 +49,8 @@ public final class MediaMetadata implements Bundleable {
/** Optional title. */ /** Optional title. */
@Nullable public final String title; @Nullable public final String title;
private MediaMetadata(@Nullable String title) { private MediaMetadata(Builder builder) {
this.title = title; this.title = builder.title;
} }
@Override @Override
...@@ -89,7 +89,8 @@ public final class MediaMetadata implements Bundleable { ...@@ -89,7 +89,8 @@ public final class MediaMetadata implements Bundleable {
/** Object that can restore {@link MediaMetadata} from a {@link Bundle}. */ /** Object that can restore {@link MediaMetadata} from a {@link Bundle}. */
public static final Creator<MediaMetadata> CREATOR = public static final Creator<MediaMetadata> CREATOR =
bundle -> new MediaMetadata(bundle.getString(keyForField(FIELD_TITLE))); bundle ->
new MediaMetadata.Builder().setTitle(bundle.getString(keyForField(FIELD_TITLE))).build();
private static String keyForField(@FieldNumber int field) { private static String keyForField(@FieldNumber int field) {
return Integer.toString(field, Character.MAX_RADIX); return Integer.toString(field, Character.MAX_RADIX);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment