Class UserDTO

java.lang.Object
com.cis.gorecipe.dto.UserDTO

public class UserDTO extends Object
This class acts as a transfer object for the User class to allow serialization of Users without making the password field visible
  • Field Details

    • id

      private Long id
      The primary key of the user
    • username

      private String username
      A unique string for user login
    • password

      private String password
      A salted and hashed password
    • email

      private String email
      An email address to allow communication with the user
    • firstName

      private String firstName
      The user's first name
    • lastName

      private String lastName
      The user's last name
    • birthDate

      private Date birthDate
      The user's birthday
    • favoriteIngredients

      private Set<Ingredient> favoriteIngredients
      A list of ingredients which the user would like to cook with
    • savedRecipes

      private Set<Recipe> savedRecipes
      A list of recipes which the user would like to revisit in the future
    • dietaryRestrictions

      private Set<String> dietaryRestrictions
      A list of restrictions on which recipes the user can cook
  • Constructor Details

    • UserDTO

      public UserDTO(User user)
      Parameters:
      user - a User object to be converted for serialization
  • Method Details

    • mapFromUser

      public static UserDTO mapFromUser(User user)
      Parameters:
      user - a User object to be converted for serialization
      Returns:
      a UserDTO object to be used for serialization
    • mapToUser

      public static User mapToUser(UserDTO userDTO)
      Parameters:
      userDTO - a UserDTO object to be converted for internal use
      Returns:
      a User object to be used internally