class ChoiceMetadataHandler implements StepMetadataHandler {

    @Override
    public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) {
        DataShape outputShape = StepMetadataHelper.getLastWithOutputShape(previousSteps)
                                                    .flatMap(Step::outputDataShape)
                                                    .orElse(StepMetadataHelper.NO_SHAPE);

        return new DynamicActionMetadata.Builder()
                        .inputShape(outputShape)
                        .outputShape(step.outputDataShape()
                                         .orElse(StepMetadataHelper.ANY_SHAPE))
                        .build();
    }

}