Added in API level 29

PropertyMapper


interface PropertyMapper
android.view.inspector.PropertyMapper

An interface for mapping the string names of inspectable properties to integer identifiers. This interface is consumed by InspectionCompanion#mapProperties(PropertyMapper). Mapping properties to IDs enables quick comparisons against shadow copies of inspectable objects without performing a large number of string comparisons. Properties that derive their value from an XML attribute should provide the attribute resource ID (e.g.: R.attr.color). For runtime or generated properties properties without attribute IDs, supply Resources#ID_NULL for attributeId.

Summary

Nested classes
open

Thrown from a map method if a property name is already mapped as different type.

Public methods
abstract Int
mapBoolean(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive boolean property.

abstract Int
mapByte(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive byte property.

abstract Int
mapChar(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive char property.

abstract Int
mapColor(name: String, attributeId: Int)

Map a string name to an integer ID for a color property.

abstract Int
mapDouble(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive double property.

abstract Int
mapFloat(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive float property.

abstract Int
mapGravity(name: String, attributeId: Int)

Map a string name to an integer ID for a gravity property.

abstract Int
mapInt(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive int property.

abstract Int
mapIntEnum(name: String, attributeId: Int, mapping: IntFunction<String!>)

Map a string name to an integer ID for an enumeration packed into an int property.

abstract Int
mapIntFlag(name: String, attributeId: Int, mapping: IntFunction<MutableSet<String!>!>)

Map a string name to an integer ID for a flag set packed into an int property.

abstract Int
mapLong(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive long property.

abstract Int
mapObject(name: String, attributeId: Int)

Map a string name to an integer ID for an object property.

abstract Int
mapResourceId(name: String, attributeId: Int)

Map a string name to an integer ID for an attribute that contains resource IDs.

abstract Int
mapShort(name: String, attributeId: Int)

Map a string name to an integer ID for a primitive short property.

Public methods

mapBoolean

Added in API level 29
abstract fun mapBoolean(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive boolean property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapByte

Added in API level 29
abstract fun mapByte(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive byte property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapChar

Added in API level 29
abstract fun mapChar(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive char property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapColor

Added in API level 29
abstract fun mapColor(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a color property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapDouble

Added in API level 29
abstract fun mapDouble(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive double property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapFloat

Added in API level 29
abstract fun mapFloat(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive float property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapGravity

Added in API level 29
abstract fun mapGravity(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a gravity property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapInt

Added in API level 29
abstract fun mapInt(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive int property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapIntEnum

Added in API level 29
abstract fun mapIntEnum(
    name: String,
    attributeId: Int,
    mapping: IntFunction<String!>
): Int

Map a string name to an integer ID for an enumeration packed into an int property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
mapping IntFunction<String!>: A mapping from int to String This value cannot be null.
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapIntFlag

Added in API level 29
abstract fun mapIntFlag(
    name: String,
    attributeId: Int,
    mapping: IntFunction<MutableSet<String!>!>
): Int

Map a string name to an integer ID for a flag set packed into an int property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
mapping IntFunction<MutableSet<String!>!>: A mapping from int to a set of strings This value cannot be null.
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapLong

Added in API level 29
abstract fun mapLong(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive long property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapObject

Added in API level 29
abstract fun mapObject(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for an object property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapResourceId

Added in API level 29
abstract fun mapResourceId(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for an attribute that contains resource IDs.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.

mapShort

Added in API level 29
abstract fun mapShort(
    name: String,
    attributeId: Int
): Int

Map a string name to an integer ID for a primitive short property.

Parameters
name String: The name of the property This value cannot be null.
attributeId Int: The attribute resource ID of this property, or Resources#ID_NULL
Return
Int An integer ID for the property
Exceptions
android.view.inspector.PropertyMapper.PropertyConflictException If the property name is already mapped as another type.