Application

Report a typo

You have the following User and Blog classes in your application:

class User {
    private long id;
    private String name;
    private String password;
    private List<Blog> blogs;

    //constructors, getters, and setters
}

class Blog {
    private long id;
    private String name;
    private User author;
    private String content;

    //constructors, getters, and setters
}

Create the AuthorStatsDTO for sending the main information about the author to the client. It should contain the id, the name of the author, and the blogsNumber which contains the number of created blogs by the author as an integer. Implement the AuthorStatsDTO as a POJO class. Your DTO must have the constructor which receives an instance of the User class as an argument, and it also must have getters and setters for all its fields. Note that your class can't be public in this task due to the testing platform specifics. The methods, however, must have a public modifier.

Sample Input 1:

No input.

Sample Output 1:

Good job!
Write a program in Java 17
class AuthorStatsDTO {
//your implementation
}
___

Create a free account to access the full topic