public final class ProtobufSerializerUtils extends Object
| Constructor and Description |
|---|
ProtobufSerializerUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Map<Field,ProtobufAttribute> |
getAllProtbufFields(Class<? extends Object> fromClazz)
Returns a full mapping of all Protobuf fields from the POJO class.
|
static String |
getPojoSetter(ProtobufAttribute protobufAttribute,
Field field)
Retrieve the setter on the POJO class; default is to is "set" plus upper case first character of the field name.
|
static Class<? extends Object> |
getProtobufClass(Object value,
Class<? extends Object> protobufClass)
Retrieve the ProtobufClass based on the POJO value.
|
static Class<? extends com.google.protobuf.GeneratedMessage> |
getProtobufClassFromPojoAnno(Class<?> clazz)
Return the Protobuf Class based on the pojo class, i.e.
|
static ProtobufEntity |
getProtobufEntity(Class<?> clazz)
Return a ProtobufEntity annotation from any object sent, null if there is none.
|
static String |
getProtobufGetter(ProtobufAttribute protobufAttribute,
Field field)
Retrieve the getter against the Protobuf class; default is to is "get" plus upper case first character of the field name.
|
static String |
getProtobufSetter(ProtobufAttribute protobufAttribute,
Field field,
Object fieldValue)
Return the setter for the Protobuf builder.
|
static boolean |
isProtbufEntity(Class<?> clazz)
Returns true if there is a ProtobufEntity annotation on this class.
|
static boolean |
isProtbufEntity(Object object)
Returns true if there is a ProtobufEntity annotation on this object.
|
public static final Class<? extends Object> getProtobufClass(Object value, Class<? extends Object> protobufClass)
Integer,
this get's converted to int.value - - POJO objectprotobufClass - - the Protobuf classpublic static final ProtobufEntity getProtobufEntity(Class<?> clazz)
clazz - - any ClassProtobufEntitypublic static final boolean isProtbufEntity(Object object)
object - - a POJO objectProtobufEntitypublic static final boolean isProtbufEntity(Class<?> clazz)
clazz - - any ClassProtobufEntitypublic static final Class<? extends com.google.protobuf.GeneratedMessage> getProtobufClassFromPojoAnno(Class<?> clazz)
clazz - - any Classpublic static final Map<Field,ProtobufAttribute> getAllProtbufFields(Class<? extends Object> fromClazz)
fromClazz - - Class<? extends Object>public static final String getProtobufSetter(ProtobufAttribute protobufAttribute, Field field, Object fieldValue)
protobufAttribute - - ProtobufAttributefield - - StringfieldValue - - POJO's filed Objectpublic static final String getProtobufGetter(ProtobufAttribute protobufAttribute, Field field)
protobufAttribute - - ProtobufAttributefield - - Fieldpublic static final String getPojoSetter(ProtobufAttribute protobufAttribute, Field field)
protobufAttribute - - ProtobufAttributefield - - FieldCopyright © 2014. All rights reserved.