-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from mpgirro/v1.0_cleanup
v1.0 cleanup
- Loading branch information
Showing
116 changed files
with
1,480 additions
and
960 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
package dev.stalla.builder | ||
|
||
import dev.stalla.model.Person | ||
import dev.stalla.model.atom.Atom | ||
import dev.stalla.model.atom.AtomPerson | ||
import dev.stalla.model.atom.Link | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** Builder for constructing [Atom] instances. */ | ||
public interface AtomBuilder : Builder<Atom> { | ||
|
||
/** Adds the [PersonBuilder] to the list of author builders. */ | ||
public fun addAuthorBuilder(authorBuilder: PersonBuilder): AtomBuilder | ||
/** Adds the [AtomPersonBuilder] to the list of author builders. */ | ||
public fun addAuthorBuilder(authorBuilder: AtomPersonBuilder): AtomBuilder | ||
|
||
/** Adds all of the [PersonBuilder] to the list of author builders. */ | ||
public fun addAllAuthorBuilder(authorBuilders: List<PersonBuilder>): AtomBuilder = | ||
/** Adds all of the [AtomPersonBuilder] to the list of author builders. */ | ||
public fun addAllAuthorBuilders(authorBuilders: List<AtomPersonBuilder>): AtomBuilder = | ||
apply { authorBuilders.forEach(::addAuthorBuilder) } | ||
|
||
/** Adds the [PersonBuilder] to the list of contributor builders. */ | ||
public fun addContributorBuilder(contributorBuilder: PersonBuilder): AtomBuilder | ||
/** Adds the [AtomPersonBuilder] to the list of contributor builders. */ | ||
public fun addContributorBuilder(contributorBuilder: AtomPersonBuilder): AtomBuilder | ||
|
||
/** Adds all of the [PersonBuilder] to the list of contributor builders. */ | ||
public fun addAllContributorBuilder(contributorBuilders: List<PersonBuilder>): AtomBuilder = | ||
/** Adds all of the [AtomPersonBuilder] to the list of contributor builders. */ | ||
public fun addAllContributorBuilders(contributorBuilders: List<AtomPersonBuilder>): AtomBuilder = | ||
apply { contributorBuilders.forEach(::addContributorBuilder) } | ||
|
||
/** Adds the [LinkBuilder] to the list of links. */ | ||
public fun addLinkBuilder(linkBuilder: LinkBuilder): AtomBuilder | ||
|
||
/** Adds all of the [LinkBuilder] to the list of links. */ | ||
public fun addAllLinkBuilder(linkBuilders: List<LinkBuilder>): AtomBuilder = | ||
public fun addAllLinkBuilders(linkBuilders: List<LinkBuilder>): AtomBuilder = | ||
apply { linkBuilders.forEach(::addLinkBuilder) } | ||
|
||
override fun applyFrom(prototype: Atom?): AtomBuilder = | ||
whenNotNull(prototype) { atom -> | ||
addAllAuthorBuilder(atom.authors.map(Person.builder()::applyFrom)) | ||
addAllContributorBuilder(atom.contributors.map(Person.builder()::applyFrom)) | ||
addAllLinkBuilder(atom.links.map(Link.builder()::applyFrom)) | ||
addAllAuthorBuilders(atom.authors.map(AtomPerson.builder()::applyFrom)) | ||
addAllContributorBuilders(atom.contributors.map(AtomPerson.builder()::applyFrom)) | ||
addAllLinkBuilders(atom.links.map(Link.builder()::applyFrom)) | ||
} | ||
} |
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,24 @@ | ||
package dev.stalla.builder | ||
|
||
import dev.stalla.model.atom.AtomPerson | ||
import dev.stalla.util.whenNotNull | ||
|
||
/** Builder for constructing [AtomPerson] instances. */ | ||
public interface AtomPersonBuilder : Builder<AtomPerson> { | ||
|
||
/** Set the name value. */ | ||
public fun name(name: String): AtomPersonBuilder | ||
|
||
/** Set the email value. */ | ||
public fun email(email: String?): AtomPersonBuilder | ||
|
||
/** Set the uri value. */ | ||
public fun uri(uri: String?): AtomPersonBuilder | ||
|
||
override fun applyFrom(prototype: AtomPerson?): AtomPersonBuilder = | ||
whenNotNull(prototype) { person -> | ||
name(person.name) | ||
email(person.email) | ||
uri(person.uri) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/dev/stalla/builder/AtomPersonBuilderProvider.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,10 @@ | ||
package dev.stalla.builder | ||
|
||
import dev.stalla.util.InternalApi | ||
|
||
@InternalApi | ||
internal interface AtomPersonBuilderProvider { | ||
|
||
/** Creates an instance of [AtomPersonBuilder] to use with this builder. */ | ||
fun createAtomPersonBuilder(): AtomPersonBuilder | ||
} |
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 was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/main/kotlin/dev/stalla/builder/PersonBuilderProvider.kt
This file was deleted.
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
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
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
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.