Bundle

Android Bundle 的包装接口。 Bundle 用于在不同组件(如 Activity, Fragment)之间传递键值对数据。

Author

M8Test, [email protected], https://m8test.com

Functions

Link copied to clipboard
abstract fun also(block: (Bundle) -> Unit): ObjectWrapper<Bundle>

对 ObjectWrapper 调用给定的 block 函数,并返回 ObjectWrapper 本身。

Link copied to clipboard
abstract fun apply(block: Bundle.() -> Unit): ObjectWrapper<Bundle>

对 ObjectWrapper 调用给定的 block 函数,并返回 ObjectWrapper 本身。

Link copied to clipboard
abstract fun clear()

清空 Bundle 中的所有数据。

Link copied to clipboard
abstract fun containsKey(key: String): Boolean

检查 Bundle 是否包含指定的键。

Link copied to clipboard
abstract fun getBoolean(key: String, defaultValue: Boolean): Boolean

获取 Boolean 类型的值。

Link copied to clipboard
abstract fun getDouble(key: String, defaultValue: Double): Double

获取 Double 类型的值。

Link copied to clipboard
abstract fun getFloat(key: String, defaultValue: Float): Float

获取 Float 类型的值。

Link copied to clipboard
abstract fun getInt(key: String, defaultValue: Int): Int

获取 Int 类型的值。

Link copied to clipboard
abstract fun getLong(key: String, defaultValue: Long): Long

获取 Long 类型的值。

Link copied to clipboard
abstract fun getOrigin(): Bundle

获取原始的对象.

Link copied to clipboard
abstract fun getString(key: String, defaultValue: String?): String?

获取 String 类型的值。

Link copied to clipboard
abstract fun isEmpty(): Boolean

检查 Bundle 是否为空。

Link copied to clipboard
abstract fun keySet(): Set<String>

获取 Bundle 中所有的键。

Link copied to clipboard
abstract fun <R> let(block: (Bundle) -> R): ObjectWrapper<R>?

对 ObjectWrapper 调用给定的 block 函数,并返回 block 函数的结果包装在 ObjectWrapper 中。

Link copied to clipboard
abstract fun putAll(bundle: Bundle)

将另一个 Bundle 中的所有映射关系复制到此 Bundle 中。

Link copied to clipboard
abstract fun putBoolean(key: String, value: Boolean)

存入 Boolean 类型数据。

Link copied to clipboard
abstract fun putBundle(key: String, value: Bundle)

存入另一个 Bundle。

Link copied to clipboard
abstract fun putByte(key: String, value: Byte)

存入 Byte 类型数据。

Link copied to clipboard
abstract fun putChar(key: String, value: Char)

存入 Char 类型数据。

Link copied to clipboard
abstract fun putCharSequence(key: String, value: CharSequence?)

存入 CharSequence 类型数据。

Link copied to clipboard
abstract fun putDouble(key: String, value: Double)

存入 Double 类型数据。

Link copied to clipboard
abstract fun putFloat(key: String, value: Float)

存入 Float 类型数据。

Link copied to clipboard
abstract fun putInt(key: String, value: Int)

存入 Int 类型数据。

Link copied to clipboard
abstract fun putLong(key: String, value: Long)

存入 Long 类型数据。

Link copied to clipboard
abstract fun putShort(key: String, value: Short)

存入 Short 类型数据。

Link copied to clipboard
abstract fun putString(key: String, value: String?)

存入 String 类型数据。

Link copied to clipboard
abstract fun remove(key: String)

移除指定键的条目。

Link copied to clipboard
abstract fun <R> run(block: Bundle.() -> R): ObjectWrapper<R>?

对 ObjectWrapper 调用给定的 block 函数,并返回 block 函数的结果包装在 ObjectWrapper 中。

Link copied to clipboard
abstract fun setOrigin(origin: Bundle)

设置原始对象

Link copied to clipboard
abstract fun size(): Int

获取 Bundle 中条目的数量。

Link copied to clipboard
abstract fun takeIf(predicate: (Bundle) -> Boolean): ObjectWrapper<Bundle>?

如果 ObjectWrapper 满足给定的 predicate,则返回 ObjectWrapper 本身,否则返回 null 包装在 ObjectWrapper? 中。

Link copied to clipboard
abstract fun takeUnless(predicate: (Bundle) -> Boolean): ObjectWrapper<Bundle>?

如果 ObjectWrapper 不满足给定的 predicate,则返回 ObjectWrapper 本身,否则返回 null 包装在 ObjectWrapper? 中。