Skip to content

Commit

Permalink
Deprecate PodcastBuilder.podcastPodcastindexBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
mpgirro committed Apr 30, 2021
1 parent d2135d8 commit 959cf9f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
1 change: 1 addition & 0 deletions api/stalla.api
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ public abstract interface class dev/stalla/builder/podcast/PodcastBuilder : dev/
public abstract fun getGoogleplayBuilder ()Ldev/stalla/builder/podcast/PodcastGoogleplayBuilder;
public abstract fun getItunesBuilder ()Ldev/stalla/builder/podcast/PodcastItunesBuilder;
public abstract fun getPodcastPodcastindexBuilder ()Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder;
public abstract fun getPodcastindexBuilder ()Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder;
public abstract fun imageBuilder (Ldev/stalla/builder/RssImageBuilder;)Ldev/stalla/builder/podcast/PodcastBuilder;
public abstract fun language (Ljava/util/Locale;)Ldev/stalla/builder/podcast/PodcastBuilder;
public abstract fun lastBuildDate (Ljava/time/temporal/TemporalAccessor;)Ldev/stalla/builder/podcast/PodcastBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface EpisodeBuilder : Builder<Episode> {
/** The builder for data from the Bitlove namespace. */
public val bitloveBuilder: EpisodeBitloveBuilder

/** The builder for data from the Podcast namespace. */
/** The builder for data from the Podcastindex namespace. */
public val podcastindexBuilder: EpisodePodcastindexBuilder

/** Set the title value. */
Expand Down
11 changes: 9 additions & 2 deletions src/main/kotlin/dev/stalla/builder/podcast/PodcastBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ public interface PodcastBuilder : Builder<Podcast> {
/** The builder for data from the Google Play namespace. */
public val googleplayBuilder: PodcastGoogleplayBuilder

/** Set the Podcast namespace builder. */
/** The builder for data from the Podcastindex namespace. */
public val podcastindexBuilder: PodcastPodcastindexBuilder

/** The builder for data from the Podcastindex namespace. */
@Deprecated(
message = "This property is scheduled for removal in v2.0.0",
replaceWith = ReplaceWith("podcastindexBuilder")
)
public val podcastPodcastindexBuilder: PodcastPodcastindexBuilder

/** Set the title value. */
Expand Down Expand Up @@ -97,7 +104,7 @@ public interface PodcastBuilder : Builder<Podcast> {
fyydBuilder.applyFrom(podcast.fyyd)
feedpressBuilder.applyFrom(podcast.feedpress)
googleplayBuilder.applyFrom(podcast.googleplay)
podcastPodcastindexBuilder.applyFrom(podcast.podcastindex)
podcastindexBuilder.applyFrom(podcast.podcastindex)
title(podcast.title)
link(podcast.link)
description(podcast.description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ internal class ValidatingPodcastBuilder : ProvidingPodcastBuilder {

override val googleplayBuilder: PodcastGoogleplayBuilder = ValidatingPodcastGoogleplayBuilder()

override val podcastPodcastindexBuilder: PodcastPodcastindexBuilder = ValidatingPodcastPodcastindexBuilder()
override val podcastindexBuilder: PodcastPodcastindexBuilder = ValidatingPodcastPodcastindexBuilder()

override val podcastPodcastindexBuilder: PodcastPodcastindexBuilder by this::podcastindexBuilder

override fun title(title: String): PodcastBuilder = apply { this.titleValue = title }

Expand Down Expand Up @@ -156,7 +158,7 @@ internal class ValidatingPodcastBuilder : ProvidingPodcastBuilder {
feedpress = feedpressBuilder.build(),
googleplay = googleplayBuilder.build(),
categories = categoryBuilders.mapNotNull { it.build() }.asUnmodifiable(),
podcastindex = podcastPodcastindexBuilder.build()
podcastindex = podcastindexBuilder.build()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ internal object PodcastindexParser : NamespaceParser() {
val lockedBuilder = ifCanBeParsed {
toLockedBuilder(builder.createLockedBuilder())
} ?: return
builder.podcastPodcastindexBuilder.lockedBuilder(lockedBuilder)
builder.podcastindexBuilder.lockedBuilder(lockedBuilder)
}
"funding" -> {
val fundingBuilder = ifCanBeParsed {
toFundingBuilder(builder.createFundingBuilder())
} ?: return
builder.podcastPodcastindexBuilder.addFundingBuilder(fundingBuilder)
builder.podcastindexBuilder.addFundingBuilder(fundingBuilder)
}
"person" -> {
val personBuilder = ifCanBeParsed {
toPersonBuilder(builder.createPersonBuilder())
} ?: return
builder.podcastPodcastindexBuilder.addPersonBuilder(personBuilder)
builder.podcastindexBuilder.addPersonBuilder(personBuilder)
}
"location" -> {
val locationBuilder = ifCanBeParsed {
toLocationBuilder(builder.createLocationBuilder())
} ?: return
builder.podcastPodcastindexBuilder.locationBuilder(locationBuilder)
builder.podcastindexBuilder.locationBuilder(locationBuilder)
}
else -> pass
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ internal class FakePodcastBuilder : FakeBuilder<Podcast>(), ProvidingPodcastBuil

override val googleplayBuilder: FakePodcastGoogleplayBuilder = FakePodcastGoogleplayBuilder()

override val podcastPodcastindexBuilder: FakePodcastPodcastindexBuilder = FakePodcastPodcastindexBuilder()
override val podcastindexBuilder: FakePodcastPodcastindexBuilder = FakePodcastPodcastindexBuilder()

override val podcastPodcastindexBuilder: FakePodcastPodcastindexBuilder by this::podcastindexBuilder

override fun title(title: String): PodcastBuilder = apply { this.titleValue = title }

Expand Down Expand Up @@ -114,7 +116,9 @@ internal class FakePodcastBuilder : FakeBuilder<Podcast>(), ProvidingPodcastBuil

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is FakePodcastBuilder) return false
if (javaClass != other?.javaClass) return false

other as FakePodcastBuilder

if (titleValue != other.titleValue) return false
if (linkValue != other.linkValue) return false
Expand All @@ -136,6 +140,7 @@ internal class FakePodcastBuilder : FakeBuilder<Podcast>(), ProvidingPodcastBuil
if (fyydBuilder != other.fyydBuilder) return false
if (feedpressBuilder != other.feedpressBuilder) return false
if (googleplayBuilder != other.googleplayBuilder) return false
if (podcastindexBuilder != other.podcastindexBuilder) return false
if (podcastPodcastindexBuilder != other.podcastPodcastindexBuilder) return false

return true
Expand All @@ -153,7 +158,7 @@ internal class FakePodcastBuilder : FakeBuilder<Podcast>(), ProvidingPodcastBuil
result = 31 * result + (docs?.hashCode() ?: 0)
result = 31 * result + (managingEditor?.hashCode() ?: 0)
result = 31 * result + (webMaster?.hashCode() ?: 0)
result = 31 * result + (ttl?.hashCode() ?: 0)
result = 31 * result + (ttl ?: 0)
result = 31 * result + (imageBuilder?.hashCode() ?: 0)
result = 31 * result + episodeBuilders.hashCode()
result = 31 * result + categoryBuilders.hashCode()
Expand All @@ -162,14 +167,17 @@ internal class FakePodcastBuilder : FakeBuilder<Podcast>(), ProvidingPodcastBuil
result = 31 * result + fyydBuilder.hashCode()
result = 31 * result + feedpressBuilder.hashCode()
result = 31 * result + googleplayBuilder.hashCode()
result = 31 * result + podcastindexBuilder.hashCode()
result = 31 * result + podcastPodcastindexBuilder.hashCode()
return result
}

override fun toString() =
"FakePodcastBuilder(titleValue=$titleValue, linkValue=$linkValue, descriptionValue=$descriptionValue, languageValue=$languageValue, " +
"pubDate=$pubDate, lastBuildDate=$lastBuildDate, generator=$generator, copyright=$copyright, docs=$docs, " +
"managingEditor=$managingEditor, webMaster=$webMaster, ttl=$ttl, imageBuilder=$imageBuilder, episodeBuilders=$episodeBuilders, " +
"categoryBuilders=$categoryBuilders, iTunesBuilder=$itunesBuilder, atomBuilder=$atomBuilder, fyydBuilder=$fyydBuilder, " +
"feedpressBuilder=$feedpressBuilder, googlePlayBuilder=$googleplayBuilder, podcastBuilder=$podcastPodcastindexBuilder)"
override fun toString(): String {
return "FakePodcastBuilder(titleValue=$titleValue, linkValue=$linkValue, descriptionValue=$descriptionValue, " +
"languageValue=$languageValue, pubDate=$pubDate, lastBuildDate=$lastBuildDate, generator=$generator, copyright=$copyright, " +
"docs=$docs, managingEditor=$managingEditor, webMaster=$webMaster, ttl=$ttl, imageBuilder=$imageBuilder, " +
"episodeBuilders=$episodeBuilders, categoryBuilders=$categoryBuilders, itunesBuilder=$itunesBuilder, atomBuilder=$atomBuilder, " +
"fyydBuilder=$fyydBuilder, feedpressBuilder=$feedpressBuilder, googleplayBuilder=$googleplayBuilder, " +
"podcastindexBuilder=$podcastindexBuilder, podcastPodcastindexBuilder=$podcastPodcastindexBuilder)"
}
}

0 comments on commit 959cf9f

Please sign in to comment.