Skip to content

Commit

Permalink
Alexa SkillStreamHandler subclass check for RequestStreamHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
oztimpower committed Mar 19, 2020
1 parent 08972b0 commit caf7ae6
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public final class AmazonLambdaProcessor {

private static final DotName REQUEST_HANDLER = DotName.createSimple(RequestHandler.class.getName());
private static final DotName REQUEST_STREAM_HANDLER = DotName.createSimple(RequestStreamHandler.class.getName());
private static final DotName SKILL_STREAM_HANDLER = DotName.createSimple("com.amazon.ask.SkillStreamHandler");

private static final DotName NAMED = DotName.createSimple(Named.class.getName());
private static final Logger log = Logger.getLogger(AmazonLambdaProcessor.class);
Expand All @@ -70,11 +71,13 @@ List<AmazonLambdaBuildItem> discover(CombinedIndexBuildItem combinedIndexBuildIt
BuildProducer<AdditionalBeanBuildItem> additionalBeanBuildItemBuildProducer,
BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer) throws BuildException {

Collection<ClassInfo> allKnownImplementors = combinedIndexBuildItem.getIndex().getAllKnownImplementors(REQUEST_HANDLER);
Collection<ClassInfo> allKnownStreamImplementors = combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(REQUEST_STREAM_HANDLER);
allKnownImplementors.addAll(combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(REQUEST_STREAM_HANDLER));
allKnownImplementors.addAll(combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(SKILL_STREAM_HANDLER));

allKnownImplementors.addAll(allKnownStreamImplementors);
if (allKnownImplementors.size() > 0 && providedLambda.isPresent()) {
throw new BuildException(
"Multiple handler classes. You have a custom handler class and the " + providedLambda.get().getProvider()
Expand Down

0 comments on commit caf7ae6

Please sign in to comment.