Merge "Improve docs for generated properties in PropertyMapper" am: 46a915f625 am: ef33f36050

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2165102

Change-Id: I0bc35e95259819ee23b41a1436ed38ed9cea5e4f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-07-28 17:57:21 +00:00
committed by Automerger Merge Worker

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.
*/