ProtoUtils
Note: This library does not have Kotlin reference docs, but you can
call the Java API from Kotlin source code. To learn more, see Kotlin's
interop documentation .
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