Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkEntityList of billy-core-jpa needs improvement #23

Open
ajcamilo opened this issue Sep 8, 2017 · 0 comments
Open

checkEntityList of billy-core-jpa needs improvement #23

ajcamilo opened this issue Sep 8, 2017 · 0 comments
Milestone

Comments

@ajcamilo
Copy link
Member

ajcamilo commented Sep 8, 2017

checkEntityList on com.premiumminds.billy.core.persistence.dao.jpa.AbstractDAO of billy-core-jpa needs improvement, because it's creating a new list with all the elements just to resolve a cast issue.

protected <T2 extends Entity> List<T2> checkEntityList(List<?> candidates, Class<T2> entityClass) {
if (candidates == null) {
return null;
}
List<T2> result = new ArrayList<>();
for (Object candidate : candidates) {
if (!entityClass.isInstance(candidate)) {
throw new RuntimeException(
"The entity is not a JPA implementation : " + candidate.getClass().getCanonicalName());
}
result.add((T2) candidate);
}
return result;
}

@froque froque added this to the billy-7 milestone Sep 14, 2022
@froque froque changed the title checkListEntity of billy-core-jpa and billy-core-ebean needs improvement checkListEntity of billy-core-jpa needs improvement Mar 29, 2023
@froque froque changed the title checkListEntity of billy-core-jpa needs improvement checkEntityList of billy-core-jpa needs improvement Mar 29, 2023
@froque froque modified the milestones: billy-8, billy-9 Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants