I have a protocol buffer message like this:
message Person {
optional string last_name = 1;
optional string first_name = 2;
}
The generated java class is as follows:
public static final class Person extends
com.google.protobuf.GeneratedMessage {
...... constructor stuffs
public static final int FIRST_NAME_FIELD_NUMBER = 1;
private boolean hasFirstName;
private java.lang.String firstName_ = "";
public boolean hasFirstName() { return hasFirstName; }
public java.lang.String getFirstName() { return firstName_; }
public static final int LAST_NAME_FIELD_NUMBER = 2;
private boolean hasLastName;
private java.lang.String lastName_ = "";
public boolean hasLastName() { return hasLastName; }
public java.lang.String getLastName() { return lastName_; }
............
}
When a java object is created, it uses the camel field name as lastName, firstName via the getLastName () and getFirstName () method. Is there a way to get the name of the camel field? I do not want to get the name of the source field: last_name, first_name and convert it again to the name of the camel name every time I want to getter and setter on my java object.
source
share