Skip to content

Commit

Permalink
Adding factories
Browse files Browse the repository at this point in the history
  • Loading branch information
anchita-g committed Sep 15, 2023
1 parent 11d3bb3 commit 8942479
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ internal interface PatchGenerator {
* certain numbers of [Patch]es.
*/
fun generate(localChanges: List<LocalChange>): List<Patch>
}

companion object {
internal fun byMode(mode: PatchGeneratorMode): PatchGenerator {
return when (mode) {
is PatchGeneratorMode.PerChange -> PerChangePatchGenerator
is PatchGeneratorMode.PerResource -> PerResourcePatchGenerator
}
internal object PatchGeneratorFactory {
fun byMode(
mode: PatchGeneratorMode,
): PatchGenerator =
when (mode) {
is PatchGeneratorMode.PerChange -> PerChangePatchGenerator
is PatchGeneratorMode.PerResource -> PerResourcePatchGenerator
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package com.google.android.fhir.sync.upload.patch

/**
* Mode to decide the type of [PatchGenerator] that needs to be used to upload the [LocalChange]s
*/
internal sealed class PatchGeneratorMode {
object PerResource : PatchGeneratorMode()

Expand Down

0 comments on commit 8942479

Please sign in to comment.