Skip to content

Commit

Permalink
Add private constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
arey committed Apr 26, 2020
1 parent f7b0c0a commit 9528000
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
* @see org.springframework.samples.petclinic.model.BaseEntity
* @since 29.10.2003
*/
public abstract class EntityUtils {
public class EntityUtils {

private EntityUtils() {
// Utility class
}

/**
* Look up the entity of the given class with the given id in the given collection.
Expand All @@ -41,8 +45,7 @@ public abstract class EntityUtils {
* @return the found entity
* @throws ObjectRetrievalFailureException if the entity was not found
*/
public static <T extends BaseEntity> T getById(Collection<T> entities, Class<T> entityClass, int entityId)
throws ObjectRetrievalFailureException {
public static <T extends BaseEntity> T getById(Collection<T> entities, Class<T> entityClass, int entityId) {
for (T entity : entities) {
if (entity.getId() == entityId && entityClass.isInstance(entity)) {
return entity;
Expand Down

0 comments on commit 9528000

Please sign in to comment.