mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:15:50 +00:00
Remove explicit unboxing
This commit is contained in:
parent
dc0fb9abd8
commit
735fb1149b
3 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue