use of org.talend.dataprep.async.conditional.ConditionalTest in project data-prep by Talend.
the class AsyncAspect method executeAsynchronously.
/**
* Return if we need to execute the method asynchronously by calling the conditionalClass definined on the annotation.
* By Default call the AlwaysTrueCondtion
* @param pjp pjp the proceeding join point.
* @return true if we need to execute the method asynchronously. False otherwise
*/
private Boolean executeAsynchronously(ProceedingJoinPoint pjp) {
MethodSignature ms = (MethodSignature) pjp.getSignature();
Method m = ms.getMethod();
final AsyncOperation asyncOperationAnnotation = m.getAnnotation(AsyncOperation.class);
Class<? extends ConditionalTest> conditionalTestGenerator = asyncOperationAnnotation.conditionalClass();
final ConditionalTest conditionalTest = applicationContext.getBean(conditionalTestGenerator);
Object[] args = AnnotationUtils.extractAsyncParameter(pjp);
return conditionalTest.apply(args);
}
Aggregations