@Target(value=TYPE)
@Documented
@GwtCompatible
public @interface Data
All non-static, non-transient fields ("data fields") become final and a getter is created for each one. For primitive boolean properties, the "is"-prefix is used.
The generation of getters can be customized using the Accessors
annotation.
If there is no user-defined constructor, a constructor taking all data fields will be generated.
If there already is a constructor, but you want the default one on top of that, you can use the FinalFieldsConstructor
annotation.
Default implementations for equals
and hashCode
are added if they don't exist yet. See EqualsHashCode
for details.
A toString
method is added if it doesn't exist yet. See ToString
for details and customization options.
Note: Although no setters are generated, this annotation does not enforce immutability. Objects passed into the constructor or returned by the getters could be modified by clients. If immutability is required, you need to implement appropriate defensive copying.