From 735fb1149b5f1e8371242313678ae41fb4cc9dc7 Mon Sep 17 00:00:00 2001 From: Antoine Rey <antoine.rey@free.fr> Date: Wed, 17 Jun 2015 18:54:26 +0200 Subject: [PATCH] Remove explicit unboxing --- .../petclinic/repository/jdbc/JdbcPetRepositoryImpl.java | 2 +- .../petclinic/repository/jdbc/JdbcVetRepositoryImpl.java | 4 ++-- .../springframework/samples/petclinic/util/EntityUtils.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 546451d..e068791 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 @@ -91,7 +91,7 @@ public class JdbcPetRepositoryImpl implements PetRepository { params, new JdbcPetRowMapper()); } catch (EmptyResultDataAccessException ex) { - throw new ObjectRetrievalFailureException(Pet.class, new Integer(id)); + throw new ObjectRetrievalFailureException(Pet.class, id); } Owner owner = this.ownerRepository.findById(pet.getOwnerId()); owner.addPet(pet); 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 9a85bde..f6e91cf 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 @@ -78,10 +78,10 @@ public class JdbcVetRepositoryImpl implements VetRepository { new BeanPropertyRowMapper<Integer>() { @Override public Integer mapRow(ResultSet rs, int row) throws SQLException { - return Integer.valueOf(rs.getInt(1)); + return rs.getInt(1); } }, - vet.getId().intValue()); + vet.getId()); for (int specialtyId : vetSpecialtiesIds) { Specialty specialty = EntityUtils.getById(specialties, Specialty.class, specialtyId); vet.addSpecialty(specialty); diff --git a/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java b/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java index a18f65c..41486a5 100644 --- a/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java +++ b/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java @@ -45,7 +45,7 @@ public abstract class EntityUtils { public static <T extends BaseEntity> T getById(Collection<T> entities, Class<T> entityClass, int entityId) throws ObjectRetrievalFailureException { for (T entity : entities) { - if (entity.getId().intValue() == entityId && entityClass.isInstance(entity)) { + if (entity.getId() == entityId && entityClass.isInstance(entity)) { return entity; } } -- GitLab