adamdebreceni commented on a change in pull request #1042: URL: https://github.com/apache/nifi-minifi-cpp/pull/1042#discussion_r609356101
########## File path: libminifi/src/core/Processor.cpp ########## @@ -386,6 +379,39 @@ std::shared_ptr<Connectable> Processor::pickIncomingConnection() { return getNextIncomingConnectionImpl(rel_guard); } +using annotation::input::EInputRequirement; + +void Processor::validateAnnotations() const { + switch (getInputRequirement()) { + case EInputRequirement::INPUT_ALLOWED: + return; + case EInputRequirement::INPUT_REQUIRED: { + if (!hasIncomingConnections()) { + throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_REQUIRED was specified for the processor, but no inputs were found"); + } + break; + } + case EInputRequirement::INPUT_FORBIDDEN: { + if (hasIncomingConnections()) { + throw Exception(PROCESS_SCHEDULE_EXCEPTION, "INPUT_FORBIDDEN was specified for the processor, but at least one input was found"); + } + break; + } + } +} + +EInputRequirement Processor::getInputRequirement() const { + // default input requirement + EInputRequirement myInputRequirement = EInputRequirement::INPUT_ALLOWED; + // get own input annotation if InputRequirementAnnotationBase is a base class Review comment: this comment got out of sync with the removal of `InputRequirementAnnotationBase` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org