Consider a scenario
We have User Object
message User {
    optional int32 user_id=1;
    optional string user_name=2;
    optional int32 user_salary=3;
}

Now user_salary in my object can be null
If I write a code 
User.newBuilder().setUserSalary(mapUserObj.get("userSalary"));
If mapUserObj.get("userSalary")=null, then it throws NullPointerException.

The other way could had been checking if it is not null and then only call 
that code.

The problem with that it makes code ugly.
So I have used AOP to avoid calling those functions. 
AOP works in case of String as it is a normal Class but in case of int or 
long it does not works.
As those are primitive and it throws Exception in Java itself.

So was thinking can Protocol Buffer generate code to use java.lang.Integer 
instead of primitive datatype?

Thanks in advance

CSJakharia

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to