Stay organized with collections
Save and categorize content based on your preferences.
IntFlagMapping
class IntFlagMapping
Maps the values of an int
property to sets of string for properties that encode flags. An InspectionCompanion
may provide an instance of this class to a PropertyMapper
for flag values packed into primitive int
properties. Each flag has a mask and a target value, for non-exclusive flags, the target can also be used as the mask. A given integer value is compared against each flag to find what flags are active for it by bitwise anding it with the mask and comparing the result against the target, that is, (value & mask) == target
.
Summary
Public methods |
Unit |
Add a mutually exclusive flag to the map.
|
MutableSet<String!> |
Get a set of the names of enabled flags for a given property value.
|
Public constructors
IntFlagMapping
IntFlagMapping()
Public methods
add
fun add(
mask: Int,
target: Int,
name: String
): Unit
Add a mutually exclusive flag to the map.
Parameters |
mask |
Int: The bit mask to compare to and with a value |
target |
Int: The target value to compare the masked value with |
name |
String: The name of the flag to include if enabled This value cannot be null . |
get
fun get(value: Int): MutableSet<String!>
Get a set of the names of enabled flags for a given property value.
Parameters |
value |
Int: The value of the property |
Return |
MutableSet<String!> |
The names of the enabled flags, empty if no flags enabled This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# IntFlagMapping\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nIntFlagMapping\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/inspector/IntFlagMapping \"View this page in Java\") \n\n```\nclass IntFlagMapping\n```\n\n|---|--------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.view.inspector.IntFlagMapping](#) |\n\nMaps the values of an `int` property to sets of string for properties that encode flags. An [InspectionCompanion](/reference/kotlin/android/view/inspector/InspectionCompanion) may provide an instance of this class to a [PropertyMapper](/reference/kotlin/android/view/inspector/PropertyMapper) for flag values packed into primitive `int` properties. Each flag has a mask and a target value, for non-exclusive flags, the target can also be used as the mask. A given integer value is compared against each flag to find what flags are active for it by bitwise anding it with the mask and comparing the result against the target, that is, `(value & mask) == target`.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------|---|\n| [IntFlagMapping](#IntFlagMapping())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [add](#add(kotlin.Int,%20kotlin.Int,%20kotlin.String))`(`mask:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `target:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Add a mutually exclusive flag to the map. |\n| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e | [get](#get(kotlin.Int))`(`value:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Get a set of the names of enabled flags for a given property value. |\n\nPublic constructors\n-------------------\n\n### IntFlagMapping\n\n```\nIntFlagMapping()\n```\n\nPublic methods\n--------------\n\n### add\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun add(\n mask: Int, \n target: Int, \n name: String\n): Unit\n```\n\nAdd a mutually exclusive flag to the map.\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `mask` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The bit mask to compare to and with a value |\n| `target` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The target value to compare the masked value with |\n| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the flag to include if enabled This value cannot be `null`. |\n\n### get\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun get(value: Int): MutableSet\u003cString!\u003e\n```\n\nGet a set of the names of enabled flags for a given property value.\n\n| Parameters ||\n|---------|-------------------------------------------------------------------------------------------------------|\n| `value` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The value of the property |\n\n| Return ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|\n| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e | The names of the enabled flags, empty if no flags enabled This value cannot be `null`. |"]]