Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c695becb authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Improve docs for generated properties in PropertyMapper" am: 46a915f6...

Merge "Improve docs for generated properties in PropertyMapper" am: 46a915f6 am: ef33f360 am: 58b0f9d6 am: 1253941b

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



Change-Id: I6960e918ce061dc2984bbfdc76511c44614a47c8
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 25c5f97e 1253941b
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -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.
     */