Home | History | Annotate | Download | only in ktx
      1 /*
      2  * Copyright 2018 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package androidx.work.ktx
     18 
     19 import androidx.work.Data
     20 
     21 /**
     22  * Converts a [Map] to a [Data] object.
     23  */
     24 @Deprecated(
     25         replaceWith = ReplaceWith(
     26                 expression = "toWorkData()",
     27                 imports = arrayOf("androidx.work.toWorkData")),
     28         level = DeprecationLevel.WARNING,
     29         message = "Use androidx.work.toWorkData instead")
     30 inline fun <V> Map<String, V>.toWorkData(): Data {
     31     val dataBuilder = Data.Builder()
     32     dataBuilder.putAll(this)
     33     return dataBuilder.build()
     34 }
     35