| package com.android.node; |
| |
| import android.R; |
| import android.util.SparseArray; |
| import android.view.inspector.InspectionCompanion; |
| import android.view.inspector.PropertyMapper; |
| import android.view.inspector.PropertyReader; |
| import java.lang.Override; |
| import java.lang.String; |
| |
| /** |
| * Inspection companion for {@link TestNode}. |
| * |
| * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator} |
| * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}. |
| */ |
| public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> { |
| /** |
| * Guards against reading properties before mapping them. |
| */ |
| private boolean mPropertiesMapped = false; |
| |
| /** |
| * Property ID of {@code intEnumProperty}. |
| */ |
| private int mIntEnumPropertyId; |
| |
| @Override |
| public void mapProperties(PropertyMapper propertyMapper) { |
| final SparseArray<String> intEnumPropertyEnumMapping = new SparseArray<>(); |
| intEnumPropertyEnumMapping.put(1, "ONE"); |
| intEnumPropertyEnumMapping.put(2, "TWO"); |
| intEnumPropertyEnumMapping.put(3, "THREE"); |
| mIntEnumPropertyId = propertyMapper.mapIntEnum("intEnumProperty", R.attr.intEnumProperty, intEnumPropertyEnumMapping::get); |
| mPropertiesMapped = true; |
| } |
| |
| @Override |
| public void readProperties(TestNode node, PropertyReader propertyReader) { |
| if (!mPropertiesMapped) { |
| throw new InspectionCompanion.UninitializedPropertyMapException(); |
| } |
| propertyReader.readIntEnum(mIntEnumPropertyId, node.getIntEnumProperty()); |
| } |
| } |