master #11

Manually merged
claudio.atzori merged 275 commits from :master into enrichment_wfs 2020-05-11 15:14:56 +02:00
1 changed files with 14 additions and 10 deletions
Showing only changes of commit 30e53261d0 - Show all commits

View File

@ -1,25 +1,29 @@
package eu.dnetlib.dhp.selectioncriteria;
import org.reflections.Reflections;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.stream.Collectors;
import org.reflections.Reflections;
public class VerbResolver implements Serializable {
private final Map<String, Class<Selection>> map;
public VerbResolver(){
this.map = new Reflections("eu.dnetlib").getTypesAnnotatedWith(VerbClass.class).stream()
.collect(Collectors.toMap(v -> v.getAnnotation(VerbClass.class).value(), v->(Class<Selection>)v));
public VerbResolver() {
this.map =
new Reflections("eu.dnetlib")
.getTypesAnnotatedWith(VerbClass.class).stream()
.collect(
Collectors.toMap(
v -> v.getAnnotation(VerbClass.class).value(),
v -> (Class<Selection>) v));
}
public Selection getSelectionCriteria(String name, String param) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
public Selection getSelectionCriteria(String name, String param)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
InstantiationException {
return map.get(name).getDeclaredConstructor((String.class)).newInstance(param);
}
}
}