-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
3,547 additions
and
137 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/main/kotlin/dev/stalla/builder/GeographicLocationBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package dev.stalla.builder | ||
|
||
import dev.stalla.model.podcastindex.GeographicLocation | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** | ||
* Builder for constructing [GeographicLocation] instances. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
public interface GeographicLocationBuilder : Builder<GeographicLocation> { | ||
|
||
/** Set the latitude value. */ | ||
public fun latitude(latitude: Double): GeographicLocationBuilder | ||
|
||
/** Set the longitude value. */ | ||
public fun longitude(longitude: Double): GeographicLocationBuilder | ||
|
||
/** Set the altitude value. */ | ||
public fun altitude(altitude: Double?): GeographicLocationBuilder | ||
|
||
/** Set the crs value. */ | ||
public fun crs(crs: String?): GeographicLocationBuilder | ||
|
||
/** Set the uncertainty value. */ | ||
public fun uncertainty(uncertainty: Double?): GeographicLocationBuilder | ||
|
||
/** Adds a [GeographicLocation.Parameter] based on [key] and [value] to the list of parameters. */ | ||
public fun addParameter(key: String, value: String): GeographicLocationBuilder | ||
|
||
/** Adds a [GeographicLocation.Parameter] to the list of parameters. */ | ||
public fun addParameter(parameter: GeographicLocation.Parameter): GeographicLocationBuilder = | ||
apply { addParameter(parameter.key, parameter.value) } | ||
|
||
/** Adds all [GeographicLocation.Parameter] to the list of parameters. */ | ||
public fun addAllParameters(parameters: List<GeographicLocation.Parameter>): GeographicLocationBuilder = | ||
apply { parameters.forEach(::addParameter) } | ||
|
||
/** Removes the parameter with [key] from the list of parameters. */ | ||
public fun removeParameter(key: String): GeographicLocationBuilder | ||
|
||
/** Removes [parameter] from the list of parameters. */ | ||
public fun removeParameter(parameter: GeographicLocation.Parameter): GeographicLocationBuilder | ||
|
||
/** Returns `true` if the coordA property is set. */ | ||
public fun hasLatitude(): Boolean | ||
|
||
/** Returns `true` if the coordB property is set. */ | ||
public fun hasLongitude(): Boolean | ||
|
||
/** Returns `true` if the coordC property is set. */ | ||
public fun hasAltitude(): Boolean | ||
|
||
override fun applyFrom(prototype: GeographicLocation?): GeographicLocationBuilder = | ||
whenNotNull(prototype) { location -> | ||
latitude(location.latitude) | ||
longitude(location.longitude) | ||
altitude(location.altitude) | ||
crs(location.crs) | ||
uncertainty(location.uncertainty) | ||
addAllParameters(location.parameters) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/kotlin/dev/stalla/builder/OpenStreetMapElementBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package dev.stalla.builder | ||
|
||
import dev.stalla.model.podcastindex.OpenStreetMapElement | ||
import dev.stalla.model.podcastindex.OpenStreetMapElementType | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** | ||
* Builder for constructing [OpenStreetMapElement] instances. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
public interface OpenStreetMapElementBuilder : Builder<OpenStreetMapElement> { | ||
|
||
/** Set the type value. */ | ||
public fun type(type: OpenStreetMapElementType): OpenStreetMapElementBuilder | ||
|
||
/** Set the id value. */ | ||
public fun id(id: Long): OpenStreetMapElementBuilder = apply { id(id) } | ||
|
||
/** Set the revision value. */ | ||
public fun revision(revision: Int?): OpenStreetMapElementBuilder = apply { revision(revision) } | ||
|
||
override fun applyFrom(prototype: OpenStreetMapElement?): OpenStreetMapElementBuilder = | ||
whenNotNull(prototype) { feature -> | ||
type(feature.type) | ||
id(feature.id) | ||
revision(feature.revision) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/dev/stalla/builder/PodcastindexLocationBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dev.stalla.builder | ||
|
||
import dev.stalla.model.podcastindex.GeographicLocation | ||
import dev.stalla.model.podcastindex.OpenStreetMapElement | ||
import dev.stalla.model.podcastindex.PodcastindexLocation | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** | ||
* Builder for constructing [PodcastindexLocation] instances. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
public interface PodcastindexLocationBuilder : Builder<PodcastindexLocation> { | ||
|
||
/** Set the name value. */ | ||
public fun name(name: String): PodcastindexLocationBuilder | ||
|
||
/** Set the geo value. */ | ||
public fun geo(geo: GeographicLocation?): PodcastindexLocationBuilder | ||
|
||
/** Set the osm value. */ | ||
public fun osm(osm: OpenStreetMapElement?): PodcastindexLocationBuilder | ||
|
||
override fun applyFrom(prototype: PodcastindexLocation?): PodcastindexLocationBuilder = | ||
whenNotNull(prototype) { location -> | ||
name(location.name) | ||
geo(GeographicLocation.builder().applyFrom(location.geo).build()) | ||
osm(OpenStreetMapElement.builder().applyFrom(location.osm).build()) | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/kotlin/dev/stalla/builder/PodcastindexPersonBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package dev.stalla.builder | ||
|
||
import dev.stalla.model.podcastindex.PodcastindexPerson | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** | ||
* Builder for constructing [PodcastindexPerson] instances. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
public interface PodcastindexPersonBuilder : Builder<PodcastindexPerson> { | ||
|
||
/** Set the name value. */ | ||
public fun name(name: String): PodcastindexPersonBuilder | ||
|
||
/** Set the role value. */ | ||
public fun role(role: String?): PodcastindexPersonBuilder | ||
|
||
/** Set the group value. */ | ||
public fun group(group: String?): PodcastindexPersonBuilder | ||
|
||
/** Set the img value. */ | ||
public fun img(img: String?): PodcastindexPersonBuilder | ||
|
||
/** Set the href value. */ | ||
public fun href(href: String?): PodcastindexPersonBuilder | ||
|
||
override fun applyFrom(prototype: PodcastindexPerson?): PodcastindexPersonBuilder = | ||
whenNotNull(prototype) { person -> | ||
name(person.name) | ||
role(person.role) | ||
group(person.group) | ||
img(person.img) | ||
href(person.href) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/dev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package dev.stalla.builder.episode | ||
|
||
import dev.stalla.builder.Builder | ||
import dev.stalla.model.podcastindex.PodcastindexEpisode | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** | ||
* Builder for constructing [PodcastindexEpisode] instances. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
public interface EpisodePodcastindexEpisodeBuilder : Builder<PodcastindexEpisode> { | ||
|
||
/** Set the number value. */ | ||
public fun number(number: Double): EpisodePodcastindexEpisodeBuilder | ||
|
||
/** Set the display value. */ | ||
public fun display(display: String?): EpisodePodcastindexEpisodeBuilder | ||
|
||
override fun applyFrom(prototype: PodcastindexEpisode?): EpisodePodcastindexEpisodeBuilder = | ||
whenNotNull(prototype) { episode -> | ||
number(episode.number) | ||
display(episode.display) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/dev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package dev.stalla.builder.episode | ||
|
||
import dev.stalla.builder.Builder | ||
import dev.stalla.model.podcastindex.PodcastindexSeason | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** | ||
* Builder for constructing [PodcastindexSeason] instances. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
public interface EpisodePodcastindexSeasonBuilder : Builder<PodcastindexSeason> { | ||
|
||
/** Set the number value. */ | ||
public fun number(number: Int): EpisodePodcastindexSeasonBuilder | ||
|
||
/** Set the name value. */ | ||
public fun name(name: String?): EpisodePodcastindexSeasonBuilder | ||
|
||
override fun applyFrom(prototype: PodcastindexSeason?): EpisodePodcastindexSeasonBuilder = | ||
whenNotNull(prototype) { season -> | ||
number(season.number) | ||
name(season.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.