Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
eaball35 committed Dec 2, 2021
1 parent e8e7312 commit 15782a6
Showing 1 changed file with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,23 @@
import java.util.stream.Collectors;

public class ExecutableSampleComposer {
public static String createExecutableSample(ExecutableSample executableSample) {
return SampleCodeWriter.write(
composeExecutableSample(
executableSample.getSampleName(),
executableSample.getSampleVariableAssignments(),
executableSample.getSampleBody()));
}

public static Optional<String> createExecutableSample(
Optional<ExecutableSample> executableSample) {
if (executableSample.isPresent()) {
ExecutableSample sample = executableSample.get();
String sampleMethodName = JavaStyle.toLowerCamelCase(sample.getSampleName());
return Optional.of(
SampleCodeWriter.write(
composeExecutableSample(
sampleMethodName,
sample.getSampleVariableAssignments(),
sample.getSampleBody())));
return Optional.of(createExecutableSample(executableSample.get()));
}
return Optional.empty();
}

public static String createExecutableSample(ExecutableSample executableSample) {
String sampleMethodName = JavaStyle.toLowerCamelCase(executableSample.getSampleName());
return SampleCodeWriter.write(
composeExecutableSample(
sampleMethodName,
executableSample.getSampleVariableAssignments(),
executableSample.getSampleBody()));
}

static ClassDefinition composeExecutableSample(
String sampleMethodName,
List<AssignmentExpr> sampleVariableAssignments,
Expand Down

0 comments on commit 15782a6

Please sign in to comment.