Improve docs for generated properties in PropertyMapper

Change-Id: I1e927013d14731d3be5024bc581ebd664f878eb9
Test: N/A
Bug: 237226979
This commit is contained in:
Ember Rose
2022-07-25 16:49:43 +00:00
parent 6e1ac19115
commit 64a82e5c30

View File

@@ -18,6 +18,7 @@ package android.view.inspector;
import android.annotation.AttrRes;
import android.annotation.NonNull;
import android.content.res.Resources;
import java.util.Set;
import java.util.function.IntFunction;
@@ -30,6 +31,10 @@ import java.util.function.IntFunction;
* 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.: {@code R.attr.color}). For runtime or generated properties properties without
* attribute IDs, supply {@link Resources#ID_NULL} for {@code attributeId}.
*
* @see InspectionCompanion#mapProperties(PropertyMapper)
*/
public interface PropertyMapper {
@@ -37,7 +42,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive boolean property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -47,7 +52,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive byte property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -57,7 +62,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive char property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -67,7 +72,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive double property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -77,7 +82,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive float property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -87,7 +92,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive int property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -97,7 +102,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive long property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -107,7 +112,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a primitive short property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -117,7 +122,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for an object property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -127,7 +132,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a color property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
* @see android.graphics.Color
@@ -138,7 +143,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a gravity property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
* @see android.view.Gravity
@@ -149,7 +154,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for an enumeration packed into an int property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @param mapping A mapping from int to String
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
@@ -163,7 +168,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for an attribute that contains resource IDs.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
*/
@@ -173,7 +178,7 @@ public interface PropertyMapper {
* Map a string name to an integer ID for a flag set packed into an int property.
*
* @param name The name of the property
* @param attributeId If the property is from an XML attribute, the resource ID of the property
* @param attributeId The attribute resource ID of this property, or {@link Resources#ID_NULL}
* @param mapping A mapping from int to a set of strings
* @return An integer ID for the property
* @throws PropertyConflictException If the property name is already mapped as another type.
@@ -182,6 +187,7 @@ public interface PropertyMapper {
@NonNull String name,
@AttrRes int attributeId,
@NonNull IntFunction<Set<String>> mapping);
/**
* Thrown from a map method if a property name is already mapped as different type.
*/