Skip to content

Commit

Permalink
DOPE-231: fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jansigi committed Sep 20, 2024
1 parent dd2887b commit b61917b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,71 @@ import ch.ergon.dope.validtype.BooleanType
import ch.ergon.dope.validtype.NumberType
import ch.ergon.dope.validtype.StringType
import ch.ergon.dope.validtype.ValidType
import com.schwarz.crystalapi.schema.CMField
import com.schwarz.crystalapi.schema.CMList
import com.schwarz.crystalapi.schema.CMJsonField
import com.schwarz.crystalapi.schema.CMJsonList

@JvmName("caseNumberField")
fun case(expression: CMField<out Number>) = CaseClass(expression.toDopeType())
fun case(expression: CMJsonField<out Number>) = CaseClass(expression.toDopeType())

@JvmName("caseStringField")
fun case(expression: CMField<String>) = CaseClass(expression.toDopeType())
fun case(expression: CMJsonField<String>) = CaseClass(expression.toDopeType())

@JvmName("caseBooleanField")
fun case(expression: CMField<Boolean>) = CaseClass(expression.toDopeType())
fun case(expression: CMJsonField<Boolean>) = CaseClass(expression.toDopeType())

@JvmName("caseNumberList")
fun case(expression: CMList<out Number>) = CaseClass(expression.toDopeType())
fun case(expression: CMJsonList<out Number>) = CaseClass(expression.toDopeType())

@JvmName("caseStringList")
fun case(expression: CMList<String>) = CaseClass(expression.toDopeType())
fun case(expression: CMJsonList<String>) = CaseClass(expression.toDopeType())

@JvmName("caseBooleanList")
fun case(expression: CMList<Boolean>) = CaseClass(expression.toDopeType())
fun case(expression: CMJsonList<Boolean>) = CaseClass(expression.toDopeType())

@JvmName("elseSearchedCMNumberWithGeneric")
fun <T : ValidType> SimpleCaseExpression<T, NumberType>.otherwise(elseCase: CMField<out Number>) =
fun <T : ValidType> SimpleCaseExpression<T, NumberType>.otherwise(elseCase: CMJsonField<out Number>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMNumberWithoutGeneric")
fun <T : ValidType> SimpleCaseExpression<T, out ValidType>.otherwise(elseCase: CMField<out Number>) =
fun <T : ValidType> SimpleCaseExpression<T, out ValidType>.otherwise(elseCase: CMJsonField<out Number>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMStringWithGeneric")
fun <T : ValidType> SimpleCaseExpression<T, StringType>.otherwise(elseCase: CMField<String>) =
fun <T : ValidType> SimpleCaseExpression<T, StringType>.otherwise(elseCase: CMJsonField<String>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMStringWithoutGeneric")
fun <T : ValidType> SimpleCaseExpression<T, out ValidType>.otherwise(elseCase: CMField<String>) =
fun <T : ValidType> SimpleCaseExpression<T, out ValidType>.otherwise(elseCase: CMJsonField<String>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMBooleanWithGeneric")
fun <T : ValidType> SimpleCaseExpression<T, BooleanType>.otherwise(elseCase: CMField<Boolean>) =
fun <T : ValidType> SimpleCaseExpression<T, BooleanType>.otherwise(elseCase: CMJsonField<Boolean>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMBooleanWithoutGeneric")
fun <T : ValidType> SimpleCaseExpression<T, out ValidType>.otherwise(elseCase: CMField<Boolean>) =
fun <T : ValidType> SimpleCaseExpression<T, out ValidType>.otherwise(elseCase: CMJsonField<Boolean>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMNumberWithGeneric")
fun <T : ValidType> SearchedCaseExpression<T>.otherwise(elseCase: CMField<out Number>) =
fun <T : ValidType> SearchedCaseExpression<T>.otherwise(elseCase: CMJsonField<out Number>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMNumberWithoutGeneric")
fun SearchedCaseExpression<NumberType>.otherwise(elseCase: CMField<out Number>) =
fun SearchedCaseExpression<NumberType>.otherwise(elseCase: CMJsonField<out Number>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMStringWithGeneric")
fun <T : ValidType> SearchedCaseExpression<T>.otherwise(elseCase: CMField<String>) =
fun <T : ValidType> SearchedCaseExpression<T>.otherwise(elseCase: CMJsonField<String>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMStringWithoutGeneric")
fun SearchedCaseExpression<StringType>.otherwise(elseCase: CMField<String>) =
fun SearchedCaseExpression<StringType>.otherwise(elseCase: CMJsonField<String>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMBooleanWithGeneric")
fun <T : ValidType> SearchedCaseExpression<T>.otherwise(elseCase: CMField<Boolean>) =
fun <T : ValidType> SearchedCaseExpression<T>.otherwise(elseCase: CMJsonField<Boolean>) =
otherwise(elseCase.toDopeType())

@JvmName("elseSearchedCMBooleanWithoutGeneric")
fun SearchedCaseExpression<BooleanType>.otherwise(elseCase: CMField<Boolean>) =
fun SearchedCaseExpression<BooleanType>.otherwise(elseCase: CMJsonField<Boolean>) =
otherwise(elseCase.toDopeType())
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ import ch.ergon.dope.validtype.BooleanType
import ch.ergon.dope.validtype.NumberType
import ch.ergon.dope.validtype.StringType
import ch.ergon.dope.validtype.ValidType
import com.schwarz.crystalapi.schema.CMField
import com.schwarz.crystalapi.schema.CMJsonField

@JvmName("caseNumberField")
fun <U : ValidType> CMField<out Number>.resultsIn(resultExpression: UnaliasedExpression<U>) =
fun <U : ValidType> CMJsonField<out Number>.resultsIn(resultExpression: UnaliasedExpression<U>) =
SearchResult(toDopeType(), resultExpression)

@JvmName("caseStringField")
fun <U : ValidType> CMField<String>.resultsIn(resultExpression: UnaliasedExpression<U>) =
fun <U : ValidType> CMJsonField<String>.resultsIn(resultExpression: UnaliasedExpression<U>) =
SearchResult(toDopeType(), resultExpression)

@JvmName("caseBooleanField")
fun <U : ValidType> CMField<Boolean>.resultsIn(resultExpression: UnaliasedExpression<U>) =
fun <U : ValidType> CMJsonField<Boolean>.resultsIn(resultExpression: UnaliasedExpression<U>) =
SearchResult(toDopeType(), resultExpression)

@JvmName("caseNumberField")
fun <T : ValidType> UnaliasedExpression<T>.resultsIn(resultField: CMField<out Number>): SearchResult<T, NumberType> =
fun <T : ValidType> UnaliasedExpression<T>.resultsIn(resultField: CMJsonField<out Number>): SearchResult<T, NumberType> =
SearchResult(this, resultField.toDopeType())

@JvmName("caseStringField")
fun <T : ValidType> UnaliasedExpression<T>.resultsIn(resultField: CMField<String>): SearchResult<T, StringType> =
fun <T : ValidType> UnaliasedExpression<T>.resultsIn(resultField: CMJsonField<String>): SearchResult<T, StringType> =
SearchResult(this, resultField.toDopeType())

@JvmName("caseBooleanField")
fun <T : ValidType> UnaliasedExpression<T>.resultsIn(resultField: CMField<Boolean>): SearchResult<T, BooleanType> =
fun <T : ValidType> UnaliasedExpression<T>.resultsIn(resultField: CMJsonField<Boolean>): SearchResult<T, BooleanType> =
SearchResult(this, resultField.toDopeType())
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CaseExpressionTest : ManagerDependentTest {
}

@Test
fun `should create CaseClass from CMList of Number`() {
fun `should create CaseClass from CMJsonList of Number`() {
val expression = someCMNumberList()
val expected = CaseClass(expression.toDopeType())

Expand All @@ -73,7 +73,7 @@ class CaseExpressionTest : ManagerDependentTest {
}

@Test
fun `should create CaseClass from CMList of String`() {
fun `should create CaseClass from CMJsonList of String`() {
val expression = someCMStringList()
val expected = CaseClass(expression.toDopeType())

Expand All @@ -83,7 +83,7 @@ class CaseExpressionTest : ManagerDependentTest {
}

@Test
fun `should create CaseClass from CMList of Boolean`() {
fun `should create CaseClass from CMJsonList of Boolean`() {
val expression = someCMBooleanList()
val expected = CaseClass(expression.toDopeType())

Expand Down

0 comments on commit b61917b

Please sign in to comment.