io.zenwave360.sdk.mongodb2jdl.Blog Maven / Gradle / Ivy
package io.zenwave360.sdk.mongodb2jdl;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
/**
* A Blog.
*/
@Document(collection = "blog")
public class Blog implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
@NotNull(message = "must not be null")
@Size(min = 3)
@Field("name")
private String name;
@NotNull(message = "must not be null")
@Size(min = 2)
@Field("handle")
private String handle;
@Field("login")
private String login;
// jhipster-needle-entity-add-field - JHipster will add fields here
public String getId() {
return this.id;
}
public Blog id(String id) {
this.setId(id);
return this;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return this.name;
}
public Blog name(String name) {
this.setName(name);
return this;
}
public void setName(String name) {
this.name = name;
}
public String getHandle() {
return this.handle;
}
public Blog handle(String handle) {
this.setHandle(handle);
return this;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getLogin() {
return this.login;
}
public Blog login(String login) {
this.setLogin(login);
return this;
}
public void setLogin(String login) {
this.login = login;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Blog)) {
return false;
}
return id != null && id.equals(((Blog) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "Blog{" +
"id=" + getId() +
", name='" + getName() + "'" +
", handle='" + getHandle() + "'" +
", login='" + getLogin() + "'" +
"}";
}
}