Comments (5)
Hi,
java_bean
template does not generate equals
/hashCode
implementation.
But you can extend it and add your implementation. For example (using Java 7 Objects class):
message_equals_and_hashcode(message, options) ::= <<
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
final <message.name> that = (<message.name>) obj;
<if(first(message.fields))>
return
<message.fields:field_equals(field=it, options=options, message=message); separator=" &&\n">;
<else>
return true;
<endif>
}
@Override
public int hashCode() {
<if(first(message.fields))>
return Objects.hash(<message.fields:field_name(field=it, options=options, message=message); separator=", ">);
<else>
return 0;
<endif>
}
>>
field_equals(field, options, message) ::= <<
Objects.equals(this.<var(val=field.name, fmt="CC", options=options)>, that.<var(val=field.name, fmt="CC", options=options)>)
>>
Maybe we can add this functionality to the next release - 1.3.2. I need to check how it affects other templates.
from protostuff.
@dyu please check these issues on google code:
- https://code.google.com/p/protostuff/issues/detail?id=144
- https://code.google.com/p/protostuff/issues/detail?id=166
I think they can be closed.
from protostuff.
Its not implemented for 1.0.x, leaving it open might be the best option.
I think leaving a comment that it is implemented in 1.3.x is enough.
I've updated the googlecode site stating that no new features will be added for 1.0.x
from protostuff.
Ladies and gents, you literally can't pay for this type of service. You are all awesome. What can i do to help? I'll start walking the docs while i'm working on this stuff.
from protostuff.
Share your experiences. Spread the word!
Hope this project benefits yours.
from protostuff.
Related Issues (20)
- how to define in java class to matches the proto blank field definition HOT 1
- Issue while running on Java 17 HOT 1
- ProtoStuff serialize data is null may cause jvm crash,and cannot be caught HOT 1
- How to solve this problem
- Serialization Deserialization parent subclass error HOT 3
- Deserialization throw NPE HOT 1
- How to support protobuf3 wrappers? HOT 1
- NPE from RuntimeEnv.loadClass
- how to replace my defined class id(int) to className HOT 2
- Protostuff Maven plugin does not support Map in Proto Version 2
- JsonIOUtil.toByteArray stack overflow when there is reference loop in message HOT 1
- Parent class add new variable,Deserialization error HOT 2
- Cause of wrapped exceptions does not get serialized
- Map conversion result is null
- become a protostuff contributor HOT 4
- Support for `readObject` and `writeObject` methods on Serializable classes
- jdk8 and jdk17 serialize String result is different
- How to serialize java class generated by protoc.exe using protostuff? HOT 2
- SO HARD TO READ CODE!!! HOT 1
- T_T
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protostuff.