public UserMessage.User toProtobuf() { return UserMessage.User.newBuilder() .setId(id.toString()) .setUsername(username == null ? "" : username) .setEmail(email == null ? "" : email) .setPassword(password == null ? "" : password) .setCreatedTimestamp(createdTimestamp == null ? 0 : createdTimestamp.getTime()) .setModifiedTimestamp(modifiedTimestamp == null ? 0 : modifiedTimestamp.getTime()) .build(); }
public UserEntity(UserMessage.User user) { id = UUID.fromString(user.getId()); username = user.getUsername(); email = user.getEmail(); password = user.getPassword(); setCreatedTimestamp(user.getCreatedTimestamp()); setModifiedTimestamp(user.getModifiedTimestamp()); }