src/main/java/org/odessajavaclub/user/adapter/in/rest/mapper/UserRoleRestMapper.java
public UserRole asUserRole(String role) {
    if (role == null) {
      return null;
    }
    switch (role) {
      case "admin":
        return UserRole.ADMIN;
      case "user":
        return UserRole.USER;
      case "readonly":
        return UserRole.READONLY;
      default:
        throw new IllegalArgumentException("Unknown role: " + role);
    }
  }
/**
   * Maps string representation to its {@link UserRole}.
   *
   * @param role string representation
   * @return {@link UserRole}
   */
Maps string representation to its  UserRole.
@param role string representation
@return  UserRole
Maps string representation to its UserRole . @param role string representation @return UserRole
public UserRole asUserRole(String role) {
    if (role == null) {
      return null;
    }
    switch (role) {
      case "admin":
        return UserRole.ADMIN;
      case "user":
        return UserRole.USER;
      case "readonly":
        return UserRole.READONLY;
      default:
        throw new IllegalArgumentException("Unknown role: " + role);
    }
  }
public UserRole asUserRole ( String role ) { if ( role == null ) { return null ; } switch ( role ) { case "admin" : return UserRole . ADMIN ; case "user" : return UserRole . USER ; case "readonly" : return UserRole . READONLY ; default : throw new IllegalArgumentException ( "Unknown role: " + role ) ; } }
Maps string representation to its {@link UserRole}.
Maps string representation to its { @link UserRole } .