Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void salvar(Pessoa p) throws Exception {
- if (p.getNome() == null) {
- throw new Exception("Nome nulo");
- } else if (p.getIdade == null) {
- throw new Exception("Idade nula");
- } else if (p.getCorDosOlhos == null) {
- throw new Exception("CorDosOlhos nulo");
- }
- }
- for (Field field : Pessoa.class.getDeclaredFields()) {
- if (Modifier.isPrivate(field.getModifiers())) {
- //faz alguma coisa aqui com field
- }
- }
Add Comment
Please, Sign In to add comment