Skip to content

Commit

Permalink
Changed Exception Type to IllegalArgumentException.
Browse files Browse the repository at this point in the history
  • Loading branch information
etrandafir93 committed Jan 19, 2024
1 parent 83350f9 commit 1f1f08c
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*
* @author Oliver Gierke
* @author Jens Schauder
* @author Emanuel Trandafir
*/
public class SimpleEntityPathResolver implements EntityPathResolver {

Expand Down Expand Up @@ -82,19 +83,22 @@ public <T> EntityPath<T> createPath(Class<T> domainClass) {
}

/**
* Resolves the static field of the given type inside the specified domain class.
* Useful for handling Scala-generated QueryDSL path classes.
* Resolves the static field of the given type inside the specified domain class. Useful for handling Scala-generated
* QueryDSL path classes.
*
* @param domainClass The domain class for which the static field needs to be resolved.
* @param javaPathClassName The Java path class name without the "$" suffix.
* @return
*/
private <T> Optional<Field> getFieldForScalaObject(Class<T> domainClass, String javaPathClassName) {
try {

Class<?> scalaPathClass = ClassUtils.forName(javaPathClassName + "$", domainClass.getClassLoader());
return getStaticFieldOfType(scalaPathClass);

} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
throw new IllegalArgumentException(
String.format(NO_CLASS_FOUND_TEMPLATE, javaPathClassName + "$", domainClass.getName()), e);
}
}

Expand Down

0 comments on commit 1f1f08c

Please sign in to comment.