org.springframework.core.ExceptionDepthComparator Java Examples
The following examples show how to use
org.springframework.core.ExceptionDepthComparator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractExceptionHandlerMethodResolver.java From spring-analysis-note with MIT License | 6 votes |
/** * Return the {@link Method} mapped to the given exception type, or {@code null} if none. */ @Nullable private Method getMappedMethod(Class<? extends Throwable> exceptionType) { List<Class<? extends Throwable>> matches = new ArrayList<>(); for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) { if (mappedException.isAssignableFrom(exceptionType)) { matches.add(mappedException); } } if (!matches.isEmpty()) { matches.sort(new ExceptionDepthComparator(exceptionType)); return this.mappedMethods.get(matches.get(0)); } else { return null; } }
Example #2
Source File: ExceptionHandlerMethodResolver.java From spring-analysis-note with MIT License | 6 votes |
/** * Return the {@link Method} mapped to the given exception type, or {@code null} if none. */ @Nullable private Method getMappedMethod(Class<? extends Throwable> exceptionType) { List<Class<? extends Throwable>> matches = new ArrayList<>(); for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) { if (mappedException.isAssignableFrom(exceptionType)) { matches.add(mappedException); } } if (!matches.isEmpty()) { matches.sort(new ExceptionDepthComparator(exceptionType)); return this.mappedMethods.get(matches.get(0)); } else { return null; } }
Example #3
Source File: AbstractExceptionHandlerMethodResolver.java From java-technology-stack with MIT License | 6 votes |
/** * Return the {@link Method} mapped to the given exception type, or {@code null} if none. */ @Nullable private Method getMappedMethod(Class<? extends Throwable> exceptionType) { List<Class<? extends Throwable>> matches = new ArrayList<>(); for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) { if (mappedException.isAssignableFrom(exceptionType)) { matches.add(mappedException); } } if (!matches.isEmpty()) { matches.sort(new ExceptionDepthComparator(exceptionType)); return this.mappedMethods.get(matches.get(0)); } else { return null; } }
Example #4
Source File: ExceptionHandlerMethodResolver.java From java-technology-stack with MIT License | 6 votes |
/** * Return the {@link Method} mapped to the given exception type, or {@code null} if none. */ @Nullable private Method getMappedMethod(Class<? extends Throwable> exceptionType) { List<Class<? extends Throwable>> matches = new ArrayList<>(); for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) { if (mappedException.isAssignableFrom(exceptionType)) { matches.add(mappedException); } } if (!matches.isEmpty()) { matches.sort(new ExceptionDepthComparator(exceptionType)); return this.mappedMethods.get(matches.get(0)); } else { return null; } }
Example #5
Source File: ExceptionHandlerMethodResolver.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Return the {@link Method} mapped to the given exception type, or {@code null} if none. */ private Method getMappedMethod(Class<? extends Throwable> exceptionType) { List<Class<? extends Throwable>> matches = new ArrayList<Class<? extends Throwable>>(); for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) { if (mappedException.isAssignableFrom(exceptionType)) { matches.add(mappedException); } } if (!matches.isEmpty()) { Collections.sort(matches, new ExceptionDepthComparator(exceptionType)); return this.mappedMethods.get(matches.get(0)); } else { return null; } }
Example #6
Source File: AbstractExceptionHandlerMethodResolver.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Return the method mapped to the given exception type or {@code null}. */ private Method getMappedMethod(Class<? extends Exception> exceptionType) { List<Class<? extends Throwable>> matches = new ArrayList<Class<? extends Throwable>>(); for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) { if (mappedException.isAssignableFrom(exceptionType)) { matches.add(mappedException); } } if (!matches.isEmpty()) { Collections.sort(matches, new ExceptionDepthComparator(exceptionType)); return this.mappedMethods.get(matches.get(0)); } else { return null; } }
Example #7
Source File: ExceptionHandlerMethodResolver.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Return the {@link Method} mapped to the given exception type, or {@code null} if none. */ private Method getMappedMethod(Class<? extends Exception> exceptionType) { List<Class<? extends Throwable>> matches = new ArrayList<Class<? extends Throwable>>(); for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) { if (mappedException.isAssignableFrom(exceptionType)) { matches.add(mappedException); } } if (!matches.isEmpty()) { Collections.sort(matches, new ExceptionDepthComparator(exceptionType)); return this.mappedMethods.get(matches.get(0)); } else { return null; } }
Example #8
Source File: AnnotationMethodHandlerExceptionResolver.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Uses the {@link ExceptionDepthComparator} to find the best matching method. * @return the best matching method, or {@code null} if none found */ private Method getBestMatchingMethod( Map<Class<? extends Throwable>, Method> resolverMethods, Exception thrownException) { if (resolverMethods.isEmpty()) { return null; } Class<? extends Throwable> closestMatch = ExceptionDepthComparator.findClosestMatch(resolverMethods.keySet(), thrownException); Method method = resolverMethods.get(closestMatch); return ((method == null) || (NO_METHOD_FOUND == method)) ? null : method; }
Example #9
Source File: AnnotationMethodHandlerExceptionResolver.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Uses the {@link ExceptionDepthComparator} to find the best matching method. * @return the best matching method, or {@code null} if none found */ private Method getBestMatchingMethod( Map<Class<? extends Throwable>, Method> resolverMethods, Exception thrownException) { if (resolverMethods.isEmpty()) { return null; } Class<? extends Throwable> closestMatch = ExceptionDepthComparator.findClosestMatch(resolverMethods.keySet(), thrownException); Method method = resolverMethods.get(closestMatch); return (method == null || NO_METHOD_FOUND == method ? null : method); }
Example #10
Source File: AnnotationMethodHandlerExceptionResolver.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Uses the {@link ExceptionDepthComparator} to find the best matching method. * @return the best matching method, or {@code null} if none found */ private Method getBestMatchingMethod( Map<Class<? extends Throwable>, Method> resolverMethods, Exception thrownException) { if (resolverMethods.isEmpty()) { return null; } Class<? extends Throwable> closestMatch = ExceptionDepthComparator.findClosestMatch(resolverMethods.keySet(), thrownException); Method method = resolverMethods.get(closestMatch); return ((method == null) || (NO_METHOD_FOUND == method)) ? null : method; }