106 lines
2.5 KiB
Java
106 lines
2.5 KiB
Java
/*
|
|
* Copyright 2025 the original author or authors.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package example.springdata.aot;
|
|
|
|
import java.time.Instant;
|
|
import java.util.List;
|
|
|
|
import org.springframework.data.mongodb.core.mapping.Field;
|
|
|
|
/**
|
|
* @author Christoph Strobl
|
|
* @since 2025/01
|
|
*/
|
|
public class User {
|
|
|
|
private final String id;
|
|
private final String username;
|
|
|
|
@Field("first_name") String firstname;
|
|
@Field("last_name") String lastname;
|
|
|
|
private List<Post> posts;
|
|
|
|
Instant registrationDate;
|
|
Instant lastSeen;
|
|
|
|
public User(String id, String username) {
|
|
this.id = id;
|
|
this.username = username;
|
|
}
|
|
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getUsername() {
|
|
return username;
|
|
}
|
|
|
|
public String getFirstname() {
|
|
return firstname;
|
|
}
|
|
|
|
public void setFirstname(String firstname) {
|
|
this.firstname = firstname;
|
|
}
|
|
|
|
public String getLastname() {
|
|
return lastname;
|
|
}
|
|
|
|
public void setLastname(String lastname) {
|
|
this.lastname = lastname;
|
|
}
|
|
|
|
public Instant getRegistrationDate() {
|
|
return registrationDate;
|
|
}
|
|
|
|
public void setRegistrationDate(Instant registrationDate) {
|
|
this.registrationDate = registrationDate;
|
|
}
|
|
|
|
public Instant getLastSeen() {
|
|
return lastSeen;
|
|
}
|
|
|
|
public void setLastSeen(Instant lastSeen) {
|
|
this.lastSeen = lastSeen;
|
|
}
|
|
|
|
public List<Post> getPosts() {
|
|
return posts;
|
|
}
|
|
|
|
public void setPosts(List<Post> posts) {
|
|
this.posts = posts;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "User{" +
|
|
"id='" + id + '\'' +
|
|
", username='" + username + '\'' +
|
|
", firstname='" + firstname + '\'' +
|
|
", lastname='" + lastname + '\'' +
|
|
", registrationDate=" + registrationDate +
|
|
", lastSeen=" + lastSeen +
|
|
", posts=" + posts +
|
|
'}';
|
|
}
|
|
}
|