The idea is to have code to be able to turn a segmented String path (e.g. foo.bar.foobbar
) into a Path<T>
where T
is a generic subtype of a well-known one. If the dot path contains an unresolvable segment I’d like to throw an exception that contains the path that already has been resolved. However it doesn’t seem like I could get the generic type of the Path<T>
into the exception and have to resort to the common supertype of T
.
I guess I’ll resort to keep the String
path that could be resolved in the exception, so that clients can do the following:
try
Path<T> path = context.getResult(…);
} catch (ResultException ex) {
Path<T> resolvedPath = context.getPath(ex.getResolvedPath());
}
Slightly more involved but should do the trick.
For reference I went with this approach in the end: spring-projects/spring-data-commons@709bb5c#diff-fd8c8b2042656f92a16069b7ccc3cceeR267