You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NewUserHandler.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.api.platform;
  21. import javax.annotation.Nullable;
  22. import org.sonar.api.ExtensionPoint;
  23. import org.sonar.api.server.ServerSide;
  24. import static java.util.Objects.requireNonNull;
  25. /**
  26. * @since 3.2
  27. */
  28. @ServerSide
  29. @ExtensionPoint
  30. public interface NewUserHandler {
  31. final class Context {
  32. private String login;
  33. private String name;
  34. private String email;
  35. private Context(String login, String name, @Nullable String email) {
  36. requireNonNull(login);
  37. requireNonNull(name);
  38. this.login = login;
  39. this.name = name;
  40. this.email = email;
  41. }
  42. public String getLogin() {
  43. return login;
  44. }
  45. public String getName() {
  46. return name;
  47. }
  48. public String getEmail() {
  49. return email;
  50. }
  51. public static Builder builder() {
  52. return new Builder();
  53. }
  54. public static final class Builder {
  55. private String login;
  56. private String name;
  57. private String email;
  58. private Builder() {
  59. }
  60. public Builder setLogin(String s) {
  61. this.login = s;
  62. return this;
  63. }
  64. public Builder setName(String s) {
  65. this.name = s;
  66. return this;
  67. }
  68. public Builder setEmail(@Nullable String s) {
  69. this.email = s;
  70. return this;
  71. }
  72. public Context build() {
  73. return new Context(login, name, email);
  74. }
  75. }
  76. }
  77. void doOnNewUser(Context context);
  78. }