Spaces:
Configuration error
Configuration error
Download src/main/java/com/example/app/mappers/UserAccountCreationMapper.java from variphx/java-learn: direct link, hf CLI and curl.
- Browser
- Download file 942 Bytes
-
https://huggingface.co/spaces/variphx/java-learn/resolve/2225c94eb81a278f6e7682c736ee781191326090/src/main/java/com/example/app/mappers/UserAccountCreationMapper.java
- Command line
-
hf download hf://spaces/variphx/java-learn@2225c94eb81a278f6e7682c736ee781191326090/src/main/java/com/example/app/mappers/UserAccountCreationMapper.java
-
curl -L -o UserAccountCreationMapper.java https://huggingface.co/spaces/variphx/java-learn/resolve/2225c94eb81a278f6e7682c736ee781191326090/src/main/java/com/example/app/mappers/UserAccountCreationMapper.java
942 Bytes
| package com.example.app.mappers; | |
| import org.springframework.stereotype.Component; | |
| import com.example.app.dtos.UserAccountCreationDto; | |
| import com.example.app.entities.UserAccount; | |
| import lombok.RequiredArgsConstructor; | |
| import org.springframework.security.crypto.password.PasswordEncoder; | |
| public class UserAccountCreationMapper implements Mapper<UserAccount, UserAccountCreationDto> { | |
| private final PasswordEncoder passwordEncoder; | |
| public UserAccount fromDto(UserAccountCreationDto dto) { | |
| return UserAccount | |
| .builder() | |
| .id(null) | |
| .email(dto.getEmail()) | |
| .passwordHash(passwordEncoder.encode(dto.getPassword())) | |
| .build(); | |
| } | |
| public UserAccountCreationDto toDto(UserAccount entity) { | |
| throw new UnsupportedOperationException("Unimplemented method 'toDto'"); | |
| } | |
| } | |