Merge "Adding UpsertionMethodProcessor and implementing using placeholder values" into androidx-main am: e225138af5
Original change: https://android-review.googlesource.com/c/platform/frameworks/support/+/2153238
Change-Id: I991c7b3ff6d929d7301a7d73c10bee7e10bbf1c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertionMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertionMethodProcessor.kt
new file mode 100644
index 0000000..a586df6
--- /dev/null
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertionMethodProcessor.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.room.processor
+
+import androidx.room.compiler.processing.XMethodElement
+import androidx.room.compiler.processing.XType
+import androidx.room.solver.CodeGenScope
+import androidx.room.solver.shortcut.binder.UpsertMethodBinder
+import androidx.room.vo.ShortcutEntity
+import androidx.room.vo.ShortcutQueryParameter
+import androidx.room.vo.UpsertionMethod
+import com.squareup.javapoet.FieldSpec
+import com.squareup.javapoet.TypeSpec
+
+class UpsertionMethodProcessor(
+ baseContext: Context,
+ val containing: XType,
+ val executableElement: XMethodElement
+) {
+ val context = baseContext.fork(executableElement)
+ class StubUpsertMethodBinder : UpsertMethodBinder(null) {
+ override fun convertAndReturn(
+ parameters: List<ShortcutQueryParameter>,
+ upsertionAdapters: Map<String, Pair<FieldSpec, TypeSpec>>,
+ dbField: FieldSpec,
+ scope: CodeGenScope
+ ) {}
+ }
+ fun process(): UpsertionMethod {
+ return UpsertionMethod(
+ element = executableElement,
+ returnType = executableElement.returnType,
+ entities = emptyMap<String, ShortcutEntity>(),
+ parameters = emptyList<ShortcutQueryParameter>(),
+ methodBinder = StubUpsertMethodBinder()
+ )
+ }
+}
\ No newline at end of file
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertionMethod.kt
similarity index 97%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertionMethod.kt
index b9d733d..fd9d44f 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertionMethod.kt
@@ -20,7 +20,7 @@
import androidx.room.compiler.processing.XType
import androidx.room.solver.shortcut.binder.UpsertMethodBinder
-data class UpsertMethod(
+data class UpsertionMethod(
val element: XMethodElement,
val entities: Map<String, ShortcutEntity>,
val returnType: XType,