use of org.talend.dataprep.async.AsyncGroupKey in project data-prep by Talend.
the class AnnotationGroupIdGenerator method getGroupId.
/**
* @see GroupIdGenerator#getGroupId(ProceedingJoinPoint)
*/
@Override
public String getGroupId(ProceedingJoinPoint pjp) {
// look for the @AsyncGroupId annotated parameter
int idParameterIndex = AnnotationUtils.getAnnotatedParameterIndex(pjp, AsyncGroupId.class);
// to get the @AsyncGroupId parameter value
final String asyncGroupId;
if (idParameterIndex >= 0) {
MethodSignature ms = (MethodSignature) pjp.getSignature();
final Class groupIdParameterType = ms.getParameterTypes()[idParameterIndex];
if (AsyncGroupKey.class.isAssignableFrom(groupIdParameterType)) {
final AsyncGroupKey paramValue = (AsyncGroupKey) pjp.getArgs()[idParameterIndex];
asyncGroupId = paramValue.getAsyncGroupKey();
} else {
asyncGroupId = String.valueOf(pjp.getArgs()[idParameterIndex]);
}
} else {
asyncGroupId = null;
}
return asyncGroupId;
}
Aggregations