ProtoUtils
This package is part of the
Android support library which
is no longer maintained.
The support library has been superseded by AndroidX
which is part of Jetpack .
We recommend using the AndroidX libraries in all new projects. You should also consider
migrating existing projects to AndroidX.
To find the AndroidX class that maps to this deprecated class, see the AndroidX
support library class
mappings .
public
final
class
ProtoUtils
extends Object
Contains various utility methods to ease use of protos and increased readability in code.
Summary
Inherited methods
From
class
java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
final
Class <?>
getClass()
int
hashCode()
final
void
notify()
final
void
notifyAll()
String
toString()
final
void
wait(long arg0, int arg1)
final
void
wait(long arg0)
final
void
wait()
Public methods
capitalizeFirstChar
String capitalizeFirstChar (String aString)
Capitalizes the first char of a String.
Examples: "espresso" -> "Espresso", "Espresso" -> "Espresso"
Parameters
aString
String
: the String to capitalize
Returns
String
capitalized String or original String, if aString was empty
checkedGetEnumForProto
T checkedGetEnumForProto (int protoEnumIndex,
Class <T> enumClass)
Maps an enum proto message type to a internal representation enum type T.
Parameters
protoEnumIndex
int
: the proto enum index of the value returned by the unwrapped proto message
enumClass
Class
: the enum class to map against
Returns
T
the enum constant for a proto enum index
getFilteredFieldList
List <Field > getFilteredFieldList (Class <?> clazz,
List <String > targetFieldNames)
Returns a filtered view of a class's declared Field
list.
Parameters
clazz
Class
: the class to introspect
targetFieldNames
List
: the field names to filter from a class Field
list