org.babyfish.jimmer.sql.ast.tuple.Tuple9.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jimmer-sql Show documentation
Show all versions of jimmer-sql Show documentation
A revolutionary ORM framework for both java and kotlin
The newest version!
package org.babyfish.jimmer.sql.ast.tuple
import org.babyfish.jimmer.sql.ast.impl.TupleImplementor
import java.util.function.BiFunction
data class Tuple9(
val _1: T1,
val _2: T2,
val _3: T3,
val _4: T4,
val _5: T5,
val _6: T6,
val _7: T7,
val _8: T8,
val _9: T9
) : TupleImplementor {
override fun size(): Int = 9
override operator fun get(index: Int): Any? =
when (index) {
0 -> _1
1 -> _2
2 -> _3
3 -> _4
4 -> _5
5 -> _6
6 -> _7
7 -> _8
8 -> _9
else -> throw IllegalArgumentException("Index must between 0 and ${size() - 1}")
}
override fun convert(block: BiFunction): TupleImplementor =
Tuple9(
block.apply(_1, 0),
block.apply(_2, 1),
block.apply(_3, 2),
block.apply(_4, 3),
block.apply(_5, 4),
block.apply(_6, 5),
block.apply(_7, 6),
block.apply(_8, 7),
block.apply(_9, 8),
)
companion object {
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection1(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 0) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection2(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 1) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection3(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 2) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection4(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 3) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection5(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 4) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection6(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 5) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection7(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 6) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection8(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 7) as Collection
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun projection9(tuples: Collection>) : Collection =
TupleImplementor.projection(tuples, 8) as Collection
}
}