PropertyMapper
interface 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 |
Map a string name to an integer ID for a primitive boolean property.
|
abstract Int |
Map a string name to an integer ID for a primitive byte property.
|
abstract Int |
Map a string name to an integer ID for a primitive char property.
|
abstract Int |
Map a string name to an integer ID for a color property.
|
abstract Int |
Map a string name to an integer ID for a primitive double property.
|
abstract Int |
Map a string name to an integer ID for a primitive float property.
|
abstract Int |
Map a string name to an integer ID for a gravity property.
|
abstract Int |
Map a string name to an integer ID for a primitive int property.
|
abstract Int |
Map a string name to an integer ID for an enumeration packed into an int property.
|
abstract Int |
Map a string name to an integer ID for a flag set packed into an int property.
|
abstract Int |
Map a string name to an integer ID for a primitive long property.
|
abstract Int |
Map a string name to an integer ID for an object property.
|
abstract Int |
Map a string name to an integer ID for an attribute that contains resource IDs.
|
abstract Int |
Map a string name to an integer ID for a primitive short property.
|
Public methods
mapBoolean
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
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
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
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
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
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
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
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
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
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
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
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
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
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. |