Commit 23075db1 authored by Iago Gómez Salgado's avatar Iago Gómez Salgado

Add validation for required fields

parent 678a1c6c
package es.uvigo.esei.daa.entities;
import static java.util.Objects.requireNonNull;
public class Pet {
private int id;
......@@ -31,7 +33,7 @@ public class Pet {
}
public void setName(String name) {
this.name = name;
this.name = requireNonNull(name, "Name can't be null");;
}
public String getKind() {
......@@ -39,7 +41,7 @@ public class Pet {
}
public void setKind(String kind) {
this.kind = kind;
this.kind = requireNonNull(kind, "Kind can't be null");;
}
public String getBreed() {
......@@ -47,7 +49,7 @@ public class Pet {
}
public void setBreed(String breed) {
this.breed = breed;
this.breed = requireNonNull(breed, "Breed can't be null");;
}
public int getOwner() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment