Skip to content

EmptyConstructor

This annotation is used to mark the default constructors required for the Spring Boot entities management

Usage

// this constructor is used by Spring Boot to initialize autonomously the EquinoxUser entity
@EmptyConstructor
public EquinoxUser() {
    this(null, null, null, null, null, null, null);
}

public EquinoxUser(String id, String token, String name, String surname, String email, String password, String language) {
    this(id, token, name, surname, email, password, DEFAULT_PROFILE_PIC, language);
}

public EquinoxUser(String id, String token, String name, String surname, String email, String password, String profilePic,
                    String language) {
    super(id);
    this.token = token;
    this.name = name;
    this.surname = surname;
    this.email = email;
    this.password = password;
    this.profilePic = profilePic;
    this.language = language;
}

public EquinoxUser(JSONObject jUser) {
    super(jUser);
    token = hItem.getString(TOKEN_KEY);
    name = hItem.getString(NAME_KEY);
    surname = hItem.getString(SURNAME_KEY);
    email = hItem.getString(EMAIL_KEY);
    password = hItem.getString(PASSWORD_KEY);
    profilePic = hItem.getString(PROFILE_PIC_KEY);
    language = hItem.getString(LANGUAGE_KEY);
}
// this constructor is used by Spring Boot to initialize autonomously the EquinoxUser entity
@EmptyConstructor
constructor() : this(null, null, null, null, null, null, null)

constructor(
    id: String?, token: String?, name: String?, surname: String?,
    email: String?, password: String?, language: String?
) : this(id, token, name, surname, email, password, DEFAULT_PROFILE_PIC, language)

constructor(
    id: String?, token: String?, name: String?, surname: String?,
    email: String?, password: String?, profilePic: String?, language: String?
) : super(id) {
    this.token = token
    this.name = name
    this.surname = surname
    this.email = email
    this.password = password
    this.profilePic = profilePic
    this.language = language
}

constructor(jUser: JSONObject) : super(jUser) {
    token = hItem.getString(TOKEN_KEY)
    name = hItem.getString(NAME_KEY)
    surname = hItem.getString(SURNAME_KEY)
    email = hItem.getString(EMAIL_KEY)
    password = hItem.getString(PASSWORD_KEY)
    profilePic = hItem.getString(PROFILE_PIC_KEY)
    language = hItem.getString(LANGUAGE_KEY)
}