Skip to content

Commit

Permalink
Renamed some methods in TaskFactories for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
kelemen committed Jul 8, 2017
1 parent 5969e8f commit e0aab2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class TaskFactories {
public static <R, I> TaskFactory<R, I> delegateToCustomKey(Function<? super I, ?> customKeySelector) {
Objects.requireNonNull(customKeySelector, "customKeySelector");

return forwardResult((nodeKey) -> {
return delegateTo((nodeKey) -> {
Object newCustomKey = customKeySelector.apply(nodeKey.getFactoryArg());
return nodeKey.withFactoryCustomKey(newCustomKey);
});
Expand All @@ -55,13 +55,13 @@ public static <R, I> TaskFactory<R, I> delegateToCustomKey(Function<? super I, ?
* a different {@link TaskFactoryKey#getFactoryArgType() factory argument type}. This
* method never returns {@code null}.
*/
public static <R, I, I2> TaskFactory<R, I> forwardResultOfInput(
public static <R, I, I2> TaskFactory<R, I> delegateToFactoryArg(
Class<I2> newArgType,
Function<? super I, ? extends I2> argTransformer) {
Objects.requireNonNull(newArgType, "newArgType");
Objects.requireNonNull(argTransformer, "argTransformer");

return forwardResult(src -> {
return delegateTo(src -> {
I2 newArg = argTransformer.apply(src.getFactoryArg());
TaskFactoryKey<R, I2> newFactoryKey = src.getFactoryKey().withFactoryArgType(newArgType);
return new TaskNodeKey<>(newFactoryKey, newArg);
Expand All @@ -87,7 +87,7 @@ public static <R, I, I2> TaskFactory<R, I> forwardResultOfInput(
* @return the task factory delegating its call to another already declared task factory.
* This method never returns {@code null}.
*/
public static <R, I, I2> TaskFactory<R, I> forwardResult(
public static <R, I, I2> TaskFactory<R, I> delegateTo(
Function<TaskNodeKey<R, I>, TaskNodeKey<R, I2>> dependencyFactory) {
return new ResultForwarderFactory<>(dependencyFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ private static TaskNodeKey<TestOutput, TestFactoryArg> key1(Object origKey) {
}

@Test
public void testForwardResult() throws Exception {
TaskFactory<TestOutput, TestFactoryArg2> factory = TaskFactories.forwardResult(TaskFactoriesTest::key1);
public void testDelegateTo() throws Exception {
TaskFactory<TestOutput, TestFactoryArg2> factory = TaskFactories.delegateTo(TaskFactoriesTest::key1);

TestTaskInputBinder inputBinder = new TestTaskInputBinder(TestOutput::new);

Expand All @@ -76,8 +76,8 @@ public void testForwardResult() throws Exception {
}

@Test
public void testForwardResultOfInput() throws Exception {
TaskFactory<TestOutput, TestFactoryArg2> factory = TaskFactories.forwardResultOfInput(
public void testDelegateToFactoryArg() throws Exception {
TaskFactory<TestOutput, TestFactoryArg2> factory = TaskFactories.delegateToFactoryArg(
TestFactoryArg.class,
TestFactoryArg::new);

Expand Down

0 comments on commit e0aab2f

Please sign in to comment.