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.
Nested classes
class
PropertyMapper.PropertyConflictException
Thrown from a map method if a property name is already mapped as different type.
Public methods
abstract
int
mapBoolean (String name, int attributeId)
Map a string name to an integer ID for a primitive boolean property.
abstract
int
mapByte (String name, int attributeId)
Map a string name to an integer ID for a primitive byte property.
abstract
int
mapChar (String name, int attributeId)
Map a string name to an integer ID for a primitive char property.
abstract
int
mapColor (String name, int attributeId)
Map a string name to an integer ID for a color property.
abstract
int
mapDouble (String name, int attributeId)
Map a string name to an integer ID for a primitive double property.
abstract
int
mapFloat (String name, int attributeId)
Map a string name to an integer ID for a primitive float property.
abstract
int
mapGravity (String name, int attributeId)
Map a string name to an integer ID for a gravity property.
abstract
int
mapInt (String name, int attributeId)
Map a string name to an integer ID for a primitive int property.
abstract
int
mapIntEnum (String name, int attributeId, IntFunction <String > mapping)
Map a string name to an integer ID for an enumeration packed into an int property.
abstract
int
mapIntFlag (String name, int attributeId, IntFunction <Set <String >> mapping)
Map a string name to an integer ID for a flag set packed into an int property.
abstract
int
mapLong (String name, int attributeId)
Map a string name to an integer ID for a primitive long property.
abstract
int
mapObject (String name, int attributeId)
Map a string name to an integer ID for an object property.
abstract
int
mapResourceId (String name, int attributeId)
Map a string name to an integer ID for an attribute that contains resource IDs.
abstract
int
mapShort (String name, int attributeId)
Map a string name to an integer ID for a primitive short property.
Public methods
mapBoolean
public abstract int mapBoolean (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapByte
public abstract int mapByte (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapChar
public abstract int mapChar (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapColor
public abstract int mapColor (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapDouble
public abstract int mapDouble (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapFloat
public abstract int mapFloat (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapGravity
public abstract int mapGravity (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapInt
public abstract int mapInt (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapIntEnum
public abstract int mapIntEnum (String name,
int attributeId,
IntFunction <String > mapping)
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: A mapping from int to String
This value cannot be null.
Returns
int
An integer ID for the property
mapIntFlag
public abstract int mapIntFlag (String name,
int attributeId,
IntFunction <Set <String >> mapping)
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: A mapping from int to a set of strings
This value cannot be null.
Returns
int
An integer ID for the property
mapLong
public abstract int mapLong (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapObject
public abstract int mapObject (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapResourceId
public abstract int mapResourceId (String name,
int attributeId)
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
Returns
int
An integer ID for the property
mapShort
public abstract int mapShort (String name,
int attributeId)
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
Returns
int
An integer ID for the property
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."],[],[]]