class SplitMetadataHandler implements StepMetadataHandler {

    @Override
    public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) {
        Optional<Step> previousStepWithDataShape = StepMetadataHelper.getLastWithOutputShape(previousSteps);

        DataShape inputShape = previousStepWithDataShape.flatMap(Step::inputDataShape)
                                                        .orElse(StepMetadataHelper.NO_SHAPE);

        DataShape outputShape = previousStepWithDataShape.flatMap(Step::outputDataShape)
                                                        .orElse(StepMetadataHelper.NO_SHAPE);

        return new DynamicActionMetadata.Builder()
                .inputShape(inputShape)
                .outputShape(outputShape)
                .build();
    }

}