| Total Complexity | 3 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package com.hltech.pact.gen.domain.client.jaxrs; |
||
| 12 | public class JaxRsClientsFinder { |
||
| 13 | |||
| 14 | public Set<Class<?>> findJaxRsClients(String packageRoot) { |
||
| 15 | Set<Class<?>> jaxRsClients = new HashSet<>(); |
||
| 16 | jaxRsClients.addAll(classAnnotatedClients(packageRoot)); |
||
| 17 | jaxRsClients.addAll(methodAnnotatedClients(packageRoot)); |
||
| 18 | |||
| 19 | return jaxRsClients; |
||
| 20 | } |
||
| 21 | |||
| 22 | private Set<Class<?>> classAnnotatedClients(String packageRoot) { |
||
| 23 | return new Reflections(packageRoot) |
||
| 24 | .getTypesAnnotatedWith(Path.class); |
||
| 25 | } |
||
| 26 | |||
| 27 | private Set<Class<?>> methodAnnotatedClients(String packageRoot) { |
||
| 28 | return new Reflections(packageRoot, new MethodAnnotationsScanner()) |
||
| 29 | .getMethodsAnnotatedWith(Path.class).stream() |
||
| 30 | .map(Method::getDeclaringClass) |
||
| 31 | .collect(Collectors.toSet()); |
||
| 32 | } |
||
| 34 |