Skip to content

Instantly share code, notes, and snippets.

@jeffersontpadua
Created March 12, 2017 10:01
Show Gist options
  • Save jeffersontpadua/1ab01a61f81aadabbb4d5ca3b57c7e81 to your computer and use it in GitHub Desktop.
Save jeffersontpadua/1ab01a61f81aadabbb4d5ca3b57c7e81 to your computer and use it in GitHub Desktop.
POJO exemplificando o princípio da Imutabilidade.
import java.time.LocalDate;
public class Pessoa {
private final String nome;
private final String cpf;
private final String rg;
private final LocalDate dataNascimento;
public Pessoa(String nome, String cpf, String rg, LocalDate dataNascimento) {
this.nome = nome;
this.cpf = cpf;
this.rg = rg;
this.dataNascimento = dataNascimento;
}
public String getNome() {
return this.nome;
}
public String getCpf() {
return this.cpf;
}
public String getRg() {
return this.rg;
}
public LocalDate getDataNascimento() {
return this.dataNascimento;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment