Ashley Rose | 0b671da | 2019-01-25 15:41:29 -0500 | [diff] [blame] | 1 | package com.android.node; |
| 2 | |
| 3 | import android.R; |
| 4 | import android.view.inspector.InspectionCompanion; |
| 5 | import android.view.inspector.IntEnumMapping; |
| 6 | import android.view.inspector.PropertyMapper; |
| 7 | import android.view.inspector.PropertyReader; |
| 8 | import java.lang.Override; |
| 9 | |
| 10 | /** |
| 11 | * Inspection companion for {@link TestNode}. |
| 12 | * |
| 13 | * Generated by {@link android.processor.view.inspector.InspectionCompanionGenerator} |
| 14 | * on behalf of {@link android.processor.view.inspector.InspectionCompanionGeneratorTest}. |
| 15 | */ |
Ashley Rose | fdb5af2 | 2019-03-08 17:23:38 -0500 | [diff] [blame] | 16 | public final class TestNode$InspectionCompanion implements InspectionCompanion<TestNode> { |
Ashley Rose | 0b671da | 2019-01-25 15:41:29 -0500 | [diff] [blame] | 17 | /** |
| 18 | * Set by {@link #mapProperties(PropertyMapper)} once properties have been mapped. |
| 19 | */ |
| 20 | private boolean mPropertiesMapped = false; |
| 21 | |
| 22 | /** |
| 23 | * Property ID of {@code intEnumProperty}. |
| 24 | */ |
| 25 | private int mIntEnumPropertyId; |
| 26 | |
| 27 | @Override |
| 28 | public void mapProperties(PropertyMapper propertyMapper) { |
| 29 | mIntEnumPropertyId = propertyMapper.mapIntEnum("intEnumProperty", R.attr.intEnumProperty, |
| 30 | new IntEnumMapping.Builder() |
| 31 | .addValue("ONE", 1) |
| 32 | .addValue("TWO", 2) |
| 33 | .addValue("THREE", 3) |
| 34 | .build()); |
| 35 | mPropertiesMapped = true; |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public void readProperties(TestNode node, PropertyReader propertyReader) { |
| 40 | if (!mPropertiesMapped) { |
| 41 | throw new InspectionCompanion.UninitializedPropertyMapException(); |
| 42 | } |
| 43 | propertyReader.readIntEnum(mIntEnumPropertyId, node.getIntEnumProperty()); |
| 44 | } |
| 45 | } |