@Canonical annotation
@Canonical: It’s very useful annotation. It provides the combination of features of @ToString (default implementation of toString() method based upon the fields in the class), @EqualsAndHashCode(default implementation of equals() and hashCode() method of the class based upon the fields in the class) and @TupleConstructor (provides the classical constructor with default properties).
[groovy]
import groovy.transform.Canonical
@Canonical
class Person {
String name
String address
String city
}
Person person = new Person(name:"Mohit Garg",address:"Address",city: "city")
Person person1 = new Person("Mohit Garg","Address","city")
println("Check two objects are equal:::"+(person.equals(person1))) // Both objects will be equal because of same hashCode. (Output:true)
println("person object:::"+person) //Output:Person(Mohit Garg, Address, city)
[/groovy]
Hope this will help you 🙂
Hi Jason,
I regret our failure in maintaining the quality of our posts, which has made us earn a lot of loyal audience. We were trying to promote the habit of blogging amongst our peers through an internal initiative, but never realized the consequences of merely improving the numbers.
It has been an eye opener for us. We are really sorry for letting you down by posting sub standard content and assure you that such instances would not be repeated.
I appreciate it that you brought it to our notice and made us realize the gravity of the situation. Sorry once again and we thank you for the continued support of our blog.
I was a proud subscriber of intelligrape’s Blogs, but now it seems that you people are posting documentation of twitter/linkedin/spring, i have a huge spam on these topics in my feed reader, thanks to you guys.
Is it a marketing or SEO initiative? because if it is, i must tell we readers don’t need documentation, we need application of concept.