class LocalBuildExecConfigExecutor implements BiFunctionConfigExecutor<LocalBuildConfigInternal, LocalBuildExecConfig, LocalBinaryConfig> {

    @Override
    public Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig) {
        Optional<LocalBinaryConfig> result = Optional.empty();
        BuildHelper.BuildResult buildResult;

        switch (localBuildConfigInternal.getBuildType()) {
            case FULL_BUILD:
                buildResult = buildHelper.build(localBuildConfigInternal.getModule());
                result = Optional.of(new LocalBuildBinaryImpl(buildResult.getBuilder(), buildResult.getBuildResults()));
                break;
            case INCREMENTAL_ADD_RESOURCE:
                result = Optional.of(new LocalBuildBinaryImpl(
                        buildHelper.addPackageResource(localBuildConfigInternal.getResource())));
                break;
            case INCREMENTAL_UPDATE_RESOURCE:
                result = Optional.of(new LocalBuildBinaryImpl(
                        buildHelper.updatePackageResource(localBuildConfigInternal.getResource())));
                break;
            case INCREMENTAL_DELETE_RESOURCE:
                result = Optional.of(new LocalBuildBinaryImpl(
                        buildHelper.deletePackageResource(localBuildConfigInternal.getResource())));
                break;
            case INCREMENTAL_BATCH_CHANGES:
                result = Optional.of(
                        new LocalBuildBinaryImpl(buildHelper.applyBatchResourceChanges(
                                localBuildConfigInternal.getModule(),
                                localBuildConfigInternal.getResourceChanges())));
                break;
            case FULL_BUILD_AND_DEPLOY:
                result = Optional.of(
                        new LocalBuildBinaryImpl(
                                buildHelper.buildAndDeploy(localBuildConfigInternal.getModule(),
                                                           localBuildConfigInternal.isSuppressHandlers(),
                                                           toDeploymentMode(localBuildConfigInternal.getDeploymentType()))));
                break;
        }
        return result;
    }

    public  LocalBuildExecConfigExecutor();
    @Inject public  LocalBuildExecConfigExecutor(BuildHelper buildHelper);

}