use of io.vertx.up.atom.agent.Event in project vertx-zero by silentbalanceyh.
the class FilterInquirer method extract.
private Event extract(final String path, final Class<?> clazz) {
final Event event = new Event();
event.setPath(path);
final Annotation annotation = clazz.getAnnotation(Ordered.class);
int order = Orders.FILTER;
if (null != annotation) {
final Integer setted = Instance.invoke(annotation, "value");
// Order specification
Fn.flingUp(setted < 0, LOGGER, FilterOrderException.class, this.getClass(), clazz);
order = order + setted;
}
event.setOrder(order);
// Proxy
final Object proxy = Instance.singleton(clazz);
Fn.flingUp(null == proxy, LOGGER, FilterInitialException.class, this.getClass(), clazz);
event.setProxy(proxy);
// Action
final Method action = this.findMethod(clazz);
event.setAction(action);
event.setConsumes(new HashSet<>());
event.setProduces(new HashSet<>());
return event;
}
use of io.vertx.up.atom.agent.Event in project vertx-zero by silentbalanceyh.
the class EventExtractor method extract.
@Override
public Set<Event> extract(final Class<?> clazz) {
return Fn.get(new ConcurrentHashSet<>(), () -> {
// 1. Class verify
this.verify(clazz);
// 2. Check whether clazz annotated with @PATH
final Set<Event> result = new ConcurrentHashSet<>();
Fn.safeSemi(clazz.isAnnotationPresent(Path.class), LOGGER, () -> {
// 3.1. Append Root Path
final Path path = ZeroHelper.getPath(clazz);
assert null != path : "Path should not be null.";
result.addAll(this.extract(clazz, PathResolver.resolve(path)));
}, () -> {
// 3.2. Use method Path directly
result.addAll(this.extract(clazz, null));
});
return result;
}, clazz);
}
use of io.vertx.up.atom.agent.Event in project vertx-zero by silentbalanceyh.
the class Flower method verifyPureArguments.
private static WebException verifyPureArguments(final Validator verifier, final Depot depot, final Object[] args) {
final Event event = depot.getEvent();
final Object proxy = event.getProxy();
final Method method = event.getAction();
WebException error = null;
try {
if (Virtual.is(proxy)) {
// TODO: Wait for proxy generation
// Validation for dynamic proxy
// final Object delegate = Instance.getProxy(method);
// verifier.verifyMethod(delegate, method, args);
} else {
// Validation for proxy
verifier.verifyMethod(proxy, method, args);
}
} catch (final WebException ex) {
// Basic validation failure
error = ex;
}
return error;
}
Aggregations