diff --git a/pom.xml b/pom.xml index e15e6ab78..201f6dd36 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ - 1.8 + 1.7 UTF-8 UTF-8 diff --git a/src/main/java/org/springframework/samples/petclinic/model/Owner.java b/src/main/java/org/springframework/samples/petclinic/model/Owner.java index 840a965ed..ca7c97ec2 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Owner.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Owner.java @@ -91,13 +91,13 @@ public class Owner extends Person { protected Set getPetsInternal() { if (this.pets == null) { - this.pets = new HashSet(); + this.pets = new HashSet<>(); } return this.pets; } public List getPets() { - List sortedPets = new ArrayList(getPetsInternal()); + List sortedPets = new ArrayList<>(getPetsInternal()); PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedPets); } diff --git a/src/main/java/org/springframework/samples/petclinic/model/Pet.java b/src/main/java/org/springframework/samples/petclinic/model/Pet.java index 4bc2b92f7..536fe07e6 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Pet.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Pet.java @@ -94,13 +94,13 @@ public class Pet extends NamedEntity { protected Set getVisitsInternal() { if (this.visits == null) { - this.visits = new HashSet(); + this.visits = new HashSet<>(); } return this.visits; } public List getVisits() { - List sortedVisits = new ArrayList(getVisitsInternal()); + List sortedVisits = new ArrayList<>(getVisitsInternal()); PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false)); return Collections.unmodifiableList(sortedVisits); } diff --git a/src/main/java/org/springframework/samples/petclinic/model/Vet.java b/src/main/java/org/springframework/samples/petclinic/model/Vet.java index c58bd85b2..61c518786 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Vet.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Vet.java @@ -56,14 +56,14 @@ public class Vet extends Person { protected Set getSpecialtiesInternal() { if (this.specialties == null) { - this.specialties = new HashSet(); + this.specialties = new HashSet<>(); } return this.specialties; } @XmlElement public List getSpecialties() { - List sortedSpecs = new ArrayList(getSpecialtiesInternal()); + List sortedSpecs = new ArrayList<>(getSpecialtiesInternal()); PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedSpecs); } diff --git a/src/main/java/org/springframework/samples/petclinic/model/Vets.java b/src/main/java/org/springframework/samples/petclinic/model/Vets.java index e8f44a7bc..aaf96b685 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Vets.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Vets.java @@ -36,7 +36,7 @@ public class Vets { @XmlElement public List getVetList() { if (vets == null) { - vets = new ArrayList(); + vets = new ArrayList<>(); } return vets; } diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java index 31839ad12..63aec2a1f 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java @@ -73,7 +73,7 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { */ @Override public Collection findByLastName(String lastName) throws DataAccessException { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("lastName", lastName + "%"); List owners = this.namedParameterJdbcTemplate.query( "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE last_name like :lastName", @@ -92,7 +92,7 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { public Owner findById(int id) throws DataAccessException { Owner owner; try { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("id", id); owner = this.namedParameterJdbcTemplate.queryForObject( "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE id= :id", @@ -107,7 +107,7 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { } public void loadPetsAndVisits(final Owner owner) { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("id", owner.getId()); final List pets = this.namedParameterJdbcTemplate.query( "SELECT pets.id, name, birth_date, type_id, owner_id, visits.id, visit_date, description, pet_id FROM pets LEFT OUTER JOIN visits ON pets.id = pet_id WHERE owner_id=:id", diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java index e068791a1..e3c02fc93 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java @@ -73,7 +73,7 @@ public class JdbcPetRepositoryImpl implements PetRepository { @Override public List findPetTypes() throws DataAccessException { - Map params = new HashMap(); + Map params = new HashMap<>(); return this.namedParameterJdbcTemplate.query( "SELECT id, name FROM types ORDER BY name", params, @@ -84,7 +84,7 @@ public class JdbcPetRepositoryImpl implements PetRepository { public Pet findById(int id) throws DataAccessException { JdbcPet pet; try { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("id", id); pet = this.namedParameterJdbcTemplate.queryForObject( "SELECT id, name, birth_date, type_id, owner_id FROM pets WHERE id=:id", diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java index f6e91cf5e..cf6ec3e42 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java @@ -60,7 +60,7 @@ public class JdbcVetRepositoryImpl implements VetRepository { */ @Override public Collection findAll() throws DataAccessException { - List vets = new ArrayList(); + List vets = new ArrayList<>(); // Retrieve the list of all vets. vets.addAll(this.jdbcTemplate.query( "SELECT id, first_name, last_name FROM vets ORDER BY last_name,first_name",