io.vertx.up.uca.web.origin.PointerInquirer Maven / Gradle / Ivy
package io.vertx.up.uca.web.origin;
import io.reactivex.Observable;
import io.vertx.up.annotations.EndPoint;
import io.vertx.up.annotations.Queue;
import javax.inject.Inject;
import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
@Deprecated
public class PointerInquirer implements Inquirer>> {
@Override
public Set> scan(final Set> allClasses) {
final Set> pointers = new HashSet<>();
// Filter Queue & Event
Observable.fromIterable(allClasses)
.filter(clazz -> !clazz.isAnnotationPresent(Queue.class) &&
!clazz.isAnnotationPresent(EndPoint.class))
.filter(this::isValid)
.subscribe(pointers::add)
.dispose();
return pointers;
}
private boolean isValid(final Class> clazz) {
final Field[] fields = clazz.getDeclaredFields();
final Long counter = Observable.fromArray(fields)
.filter(field -> field.isAnnotationPresent(Inject.class))
.count().blockingGet();
return 0 < counter;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy