APIv3/src/main/java/net/frozenorb/apiv3/model/User.java

37 lines
618 B
Java
Raw Normal View History

2016-02-12 02:40:06 +01:00
package net.frozenorb.apiv3.model;
import lombok.Getter;
import lombok.ToString;
2016-02-12 06:31:57 +01:00
import net.frozenorb.apiv3.accessor.Users;
2016-02-12 02:40:06 +01:00
import org.bson.Document;
@ToString
2016-02-12 06:31:57 +01:00
public final class User extends BaseModel {
2016-02-12 02:40:06 +01:00
@Getter private String id;
public User(Document json) {
2016-02-12 06:31:57 +01:00
super(Users.COLLECTION_NAME);
2016-02-12 02:40:06 +01:00
this.id = json.getString("_id");
2016-02-12 06:31:57 +01:00
setId(id);
2016-02-12 02:40:06 +01:00
}
public Document toLiteJson() {
Document json = new Document();
json.put("_id", id);
return json;
}
public Document toFullJson() {
Document json = toLiteJson();
return json;
}
}