I'm using google's protobuf library that autogenerates code for you. So if you have a PersonRequest
for your Person
object, it'll generate code for you that looks something like
PersonRequest.parseFrom(byte[] bytes)
So for each of my requests, I have some code that looks like
XXXXXRequest.paseFrom(byte[] bytes)
What I want to do is write an interface like
public interface MyInterface<T> {
T parseFrom(byte[] bytes)
}
And then after that, I'm not really sure what to do in the implementation. Does it go like
public class MyInterfaceImpl<T> implements MyInterface<T> {
@Override
T parseFrom(byte[] bytes) {
return T.parseFrom(bytes); // what do I do here?
}
}
I'm not sure if it's possible to get the object's methods through reflection or what I should do here?
Aucun commentaire:
Enregistrer un commentaire