Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package wow;
  6.  
  7. /**
  8. *
  9. * @author Jackson
  10. */
  11. public class Personagem {
  12.  
  13. private final String nome;
  14. private final String raca;
  15. private final String classe;
  16. private final String cor;
  17.  
  18. public static class Builder {
  19.  
  20. private final String nome;
  21. private final String raca;
  22. private String classe;
  23. private String cor;
  24.  
  25. public Builder(String nome, String raca) {
  26. this.nome = nome;
  27. this.raca = raca;
  28. }
  29.  
  30. public Builder classe(String val) {
  31. classe = val;
  32. return this;
  33. }
  34. public Builder cor(String val) {
  35. cor = val;
  36. return this;
  37. }
  38.  
  39. public Personagem build() {
  40. return new Personagem(this);
  41. }
  42. }
  43. private Personagem(Builder builder) {
  44. nome = builder.nome;
  45. raca = builder.raca;
  46. classe = builder.classe;
  47. cor = builder.cor;
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement