// is visting the parent method, since the method visiting order is always from the leaf class walking
// up the class hierarchy.
return;
}
ProcessInput processInputAnnotation = method.getAnnotation(ProcessInput.class);
Tick tickAnnotation = method.getAnnotation(Tick.class);
if (processInputAnnotation == null && tickAnnotation == null) {
return;
}
// Check for tick method
if (tickAnnotation != null) {
Preconditions.checkArgument(processInputAnnotation == null,
"Tick method %s.%s should not have ProcessInput.",
inspectType.getRawType().getName(), method);
Preconditions.checkArgument(method.getParameterTypes().length == 0,
"Tick method %s.%s cannot have parameters.",
inspectType.getRawType().getName(), method);
return;
}
Type[] methodParams = method.getGenericParameterTypes();
Preconditions.checkArgument(methodParams.length > 0 && methodParams.length <= 2,
"Parameter missing from process method %s.%s.",
inspectType.getRawType().getName(), method);
// If there is more than one parameter there can only be exactly two; the second one must be InputContext type
if (methodParams.length == 2) {
Preconditions.checkArgument(InputContext.class.equals(TypeToken.of(methodParams[1]).getRawType()),
"Second parameter must be InputContext type for process method %s.%s.",
inspectType.getRawType().getName(), method);
}
// Extract the Input type from the first parameter of the process method
Type inputType = getInputType(inspectType, method, inspectType.resolveType(methodParams[0]).getType());
Preconditions.checkArgument(Reflections.isResolved(inputType),
"Invalid type in %s.%s. Only Class or ParameterizedType are supported.",
inspectType.getRawType().getName(), method);
List<String> inputNames = Lists.newLinkedList();
if (processInputAnnotation.value().length == 0) {
inputNames.add(FlowletDefinition.ANY_INPUT);
} else {
Collections.addAll(inputNames, processInputAnnotation.value());
}
for (String inputName : inputNames) {
Set<Type> types = inputTypes.get(inputName);
if (types == null) {