ProtoUtil
public
class
ProtoUtil
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.ProtoUtil |
Utility methods for dealing with protobuf messages type-agnostically.
Summary
Public constructors | |
---|---|
ProtoUtil()
|
Public methods | |
---|---|
static
|
getNestedFieldFromMessageAsStrings(Message message,
Get values of a nested field reference, i.e. |
Public constructors
ProtoUtil
public ProtoUtil ()
Public methods
getNestedFieldFromMessageAsStrings
public staticgetNestedFieldFromMessageAsStrings (Message message, references)
Get values of a nested field reference, i.e. field_1.field_2.field_3, from a proto message as a list of strings. Returns an empty list when a field cannot be found.
If the field reference contains repeated fields, each instance is expanded, resulting in a list of strings.
Parameters | |
---|---|
message |
Message : The protobuf Message or object to be parsed. |
references |
: A list of field references starting at the root of the message. e.g. if we
want to read field_2 under the value of field_1 in messageOrObject the list would be field1 , field2 . |
Returns | |
---|---|
|
A list of all the fields values referred to by the reference. If references
is empty, returns message.toString() as a list. If references is invalid,
returns an empty list. |