-
Notifications
You must be signed in to change notification settings - Fork 1
Description
@DaTa is a powerful annotation that includes @tostring, @EqualsAndHashCode, @Getter, @Setter, and @requiredargsconstructor. As a powerful annotation, it also comes with several side effects.
Here are some potential issues that can arise from using @DaTa:
Excessive use of Setter methods:
Setters may be used excessively, leading to unclear intentions and making it difficult to guarantee the object's safety as the state can be changed at any time.
By avoiding unnecessary mutation points, you can ensure stability.
@tostring: Circular reference in bidirectional associations:
Let's consider a situation where Member and Coupon are mapped in a one-to-many bidirectional association.
When calling ToString, it can result in an infinite loop due to circular referencing.
To address this issue, you can use the annotation as follows: @tostring(exclude = "coupons") to exclude specific fields.
@EqualsAndHashCode:
@EqualsAndHashCode generates high-quality equals() and hashCode() methods. While it can be beneficial when used properly, overusing it can lead to serious issues.
One particular concern is when it is applied to mutable objects without any parameters.