PropertyReader
public
interface
PropertyReader
android.view.inspector.PropertyReader |
An interface for reading the properties of an inspectable object.
PropertyReader
is defined as an interface that will be called by
InspectionCompanion.readProperties(Object, PropertyReader)
. This approach allows a
client inspector to read the values of primitive properties without the overhead of
instantiating a class to hold the property values for each inspection pass. If an inspectable
remains unchanged between reading passes, it should be possible for a PropertyReader
to
avoid new allocations for subsequent reading passes.
It has separate methods for all primitive types to avoid autoboxing overhead if a concrete
implementation is able to work with primitives. Implementations should be prepared to accept
{null} as the value of PropertyReader.readObject(int, Object)
.
Summary
Nested classes | |
---|---|
class |
PropertyReader.PropertyTypeMismatchException
Thrown if a client calls a typed read method for a property of a different type. |
Public methods | |
---|---|
abstract
void
|
readBoolean(int id, boolean value)
Read a primitive boolean property. |
abstract
void
|
readByte(int id, byte value)
Read a primitive byte property. |
abstract
void
|
readChar(int id, char value)
Read a primitive character property. |
abstract
void
|
readColor(int id, int value)
Read a color packed into an int as a property. |
abstract
void
|
readColor(int id, long value)
Read a color packed into a |
abstract
void
|
readColor(int id, Color value)
Read a |
abstract
void
|
readDouble(int id, double value)
Read a read a primitive double property. |
abstract
void
|
readFloat(int id, float value)
Read a primitive float property. |
abstract
void
|
readGravity(int id, int value)
Read |
abstract
void
|
readInt(int id, int value)
Read a primitive integer property. |
abstract
void
|
readIntEnum(int id, int value)
Read an enumeration packed into a primitive |
abstract
void
|
readIntFlag(int id, int value)
Read a flag packed into a primitive |
abstract
void
|
readLong(int id, long value)
Read a primitive long property. |
abstract
void
|
readObject(int id, Object value)
Read any object as a property. |
abstract
void
|
readResourceId(int id, int value)
Read an integer that contains a resource ID. |
abstract
void
|
readShort(int id, short value)
Read a primitive short property. |
Public methods
readBoolean
public abstract void readBoolean (int id, boolean value)
Read a primitive boolean property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
boolean : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a boolean |
readByte
public abstract void readByte (int id, byte value)
Read a primitive byte property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
byte : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a byte |
readChar
public abstract void readChar (int id, char value)
Read a primitive character property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
char : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a char |
readColor
public abstract void readColor (int id, int value)
Read a color packed into an int as a property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
int : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a color |
readColor
public abstract void readColor (int id, long value)
Read a color packed into a ColorLong
as a property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
long : Value of the property packed as a ColorLong . See the
Color class for details of the packing. |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a color |
readColor
public abstract void readColor (int id, Color value)
Read a Color
object as a property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
Color : Value of the property
This value may be null . |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a color |
readDouble
public abstract void readDouble (int id, double value)
Read a read a primitive double property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
double : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a double |
readFloat
public abstract void readFloat (int id, float value)
Read a primitive float property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
float : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a float |
readGravity
public abstract void readGravity (int id, int value)
Read Gravity
packed into an primitive int
.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
int : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a gravity property |
readInt
public abstract void readInt (int id, int value)
Read a primitive integer property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
int : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as an int |
readIntEnum
public abstract void readIntEnum (int id, int value)
Read an enumeration packed into a primitive int
.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
int : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as an object |
readIntFlag
public abstract void readIntFlag (int id, int value)
Read a flag packed into a primitive int
.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
int : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as an object |
readLong
public abstract void readLong (int id, long value)
Read a primitive long property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
long : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a long |
readObject
public abstract void readObject (int id, Object value)
Read any object as a property. If value is null, the property is marked as empty.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
Object : Value of the property
This value may be null . |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as an object |
readResourceId
public abstract void readResourceId (int id, int value)
Read an integer that contains a resource ID.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
int : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a resource ID. |
readShort
public abstract void readShort (int id, short value)
Read a primitive short property.
Parameters | |
---|---|
id |
int : Identifier of the property from a PropertyMapper |
value |
short : Value of the property |
Throws | |
---|---|
PropertyReader.PropertyTypeMismatchException |
If the property ID is not mapped as a short |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-12-18 UTC.