I am rookie in Java Annotation
and have been searching for applying single annotation
on multiple variable simultaneously.
Code:
@Document(collection = "users")
public class User {
private ObjectId id;
@NotNull
private String email;
private String imageURL;
private String authToken;
private Date createdDate;
private Date updateDate;
private boolean isActivated;
private int credits;
.....getter/Setter Method
I want to apply @NotNull
property on email
, imageURL
and authToken
too. I can do it by writing @NotNull
to each variable
but not preferring. How to do it?