Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

InspectableProperty

public abstract @interface InspectableProperty
implements Annotation

androidx.annotation.InspectableProperty


Denotes that the annotated method is the getter for a resources-backed property that should be shown in Android Studio's inspection tools.

Summary

Nested classes

@interface InspectableProperty.EnumEntry

One entry in an enumeration packed into a primitive {int}. 

@interface InspectableProperty.FlagEntry

One flag value of many that may be packed into a primitive {int}. 

enum InspectableProperty.ValueType

The type of value packed into a primitive {int}. 

Public methods

int attributeId()

If the property is inflated from XML, the resource ID of its XML attribute.

EnumEntry[] enumMapping()

For enumerations packed into primitive {int} properties, map the values to string names.

FlagEntry[] flagMapping()

For flags packed into primitive {int} properties, model the string names of the flags.

boolean hasAttributeId()

If this property has an attribute ID.

String name()

The name of the property.

InspectableProperty.ValueType valueType()

Specify how to interpret a value type packed into a primitive integer.

Inherited methods

Public methods

attributeId

public int attributeId ()

If the property is inflated from XML, the resource ID of its XML attribute. If left as the default, and hasAttributeId() is true, the attribute ID will be inferred from name().

Returns
int The attribute ID of the property or the default null resource ID

enumMapping

public EnumEntry[] enumMapping ()

For enumerations packed into primitive {int} properties, map the values to string names. Note that #enumMapping() cannot be used simultaneously with flagMapping().

Returns
EnumEntry[] An array of InspectableProperty.EnumEntry, empty if not applicable

flagMapping

public FlagEntry[] flagMapping ()

For flags packed into primitive {int} properties, model the string names of the flags. Note that #flagMapping() cannot be used simultaneously with enumMapping().

Returns
FlagEntry[] An array of InspectableProperty.FlagEntry, empty if not applicable

hasAttributeId

public boolean hasAttributeId ()

If this property has an attribute ID. Set to false if the annotated property does not have an attribute ID, that is, it is not inflated from an XML attribute. This will prevent the automatic inference of the attribute.

Returns
boolean Whether to infer an attribute ID if not supplied

name

public String name ()

The name of the property. If left empty (the default), the property name will be inferred from the name of the getter method.

Returns
String The name of the property.

valueType

public InspectableProperty.ValueType valueType ()

Specify how to interpret a value type packed into a primitive integer.

Returns
InspectableProperty.ValueType A InspectableProperty.ValueType